diff --git a/src/__tests__/Navigation.test.tsx b/src/__tests__/Navigation.test.tsx index 34021d5..f5a97d3 100644 --- a/src/__tests__/Navigation.test.tsx +++ b/src/__tests__/Navigation.test.tsx @@ -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 }) => ( + {children} + ), +})) + // 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', () => {