// Mock environment variables process.env.NEXT_PUBLIC_SITE_URL = 'http://localhost:3001'; // Mock Next.js router jest.mock('next/navigation', () => ({ useRouter: () => ({ push: jest.fn(), replace: jest.fn(), prefetch: jest.fn(), back: jest.fn(), forward: jest.fn(), refresh: jest.fn(), pathname: '/', query: {}, }), usePathname: () => '/', useSearchParams: () => new URLSearchParams(), })); // Mock Next.js server components jest.mock('next/headers', () => ({ cookies: () => ({ get: jest.fn(() => ({ value: 'mock-cookie-value' })), set: jest.fn(), delete: jest.fn(), }), headers: () => new Map(), })); // Mock Next.js Image component jest.mock('next/image', () => ({ __esModule: true, default: function MockImage(props) { // Return a mock object instead of JSX return { type: 'img', props: { ...props, alt: props.alt || '' } }; }, })); // Unauthenticated browser session unless a test opts into authentication. jest.mock('@/lib/auth-client', () => ({ authClient: { useSession: jest.fn(() => ({ data: null, isPending: false })), signIn: { social: jest.fn() }, signOut: jest.fn(), }, }));