feat/bun-transition #21

Merged
david merged 24 commits from feat/bun-transition into main 2026-04-02 04:51:20 +00:00
Showing only changes of commit e4c4333b40 - Show all commits
+12 -3
View File
@@ -9,6 +9,13 @@ import { describe, it, expect, mock, beforeEach, afterEach } from 'bun:test'
import { render, screen, waitFor } from '@testing-library/react'
import Navigation from '@/components/Navigation'
// Mock next/link
mock.module('next/link', () => ({
default: ({ children, href }: { children: React.ReactNode; href: string }) => (
<a href={href}>{children}</a>
),
}))
// Mock the SessionProvider
mock.module('@/components/SessionProvider', () => ({
useSession: mock(() => {}),
@@ -28,8 +35,9 @@ import { useSession } from '@/components/SessionProvider'
describe('Epic 1: Navigation Component', () => {
beforeEach(() => {
mock.clearAllMocks();
(global.fetch).mockImplementation(async (url) => {
// Don't clear all mocks as it might affect bun-setup.ts
// Set up default fetch mock
(global.fetch as any).mockImplementation?.(async (url: any) => {
if (url?.toString().includes('/api/users/')) {
return new Response(JSON.stringify({ role: 'player' }), {
status: 200,
@@ -41,7 +49,8 @@ describe('Epic 1: Navigation Component', () => {
})
afterEach(() => {
mock.clearAllMocks();
// Don't clear mocks - let them persist for other test files
// Navigation relies on module mocks set up at file level
})
it('renders the logo and basic links when not logged in', () => {