From 28292f746eeaf044f251d5499d69eb06d466744b Mon Sep 17 00:00:00 2001 From: Stockboy Steve Date: Sun, 29 Mar 2026 19:55:11 +0000 Subject: [PATCH] fix: mock authClient.useSession in App.test.tsx Pre-existing test failure from Phase 1 better-auth migration. Dashboard calls authClient.useSession() which makes an unresolved async call in test environment. Mock it to return null session (isPending: false) so the unauthenticated UI renders correctly. Co-Authored-By: Paperclip --- src/App.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index 00a2593..27e040d 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,7 +1,13 @@ import { render, screen } from '@testing-library/react' -import { describe, it, expect } from 'vitest' +import { describe, it, expect, vi } from 'vitest' import App from './App.tsx' +vi.mock('./lib/auth-client.ts', () => ({ + authClient: { + useSession: () => ({ data: null, isPending: false }), + }, +})) + describe('App', () => { it('renders the dashboard on the root route', () => { render()