forked from cartsnitch/app
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 <noreply@paperclip.ing>
This commit is contained in:
+7
-1
@@ -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(<App />)
|
||||
|
||||
Reference in New Issue
Block a user