28292f746e
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>
24 lines
706 B
TypeScript
24 lines
706 B
TypeScript
import { render, screen } from '@testing-library/react'
|
|
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 />)
|
|
expect(screen.getByText('CartSnitch')).toBeInTheDocument()
|
|
})
|
|
|
|
it('renders the bottom navigation', () => {
|
|
render(<App />)
|
|
expect(screen.getByText('Home')).toBeInTheDocument()
|
|
expect(screen.getByText('Purchases')).toBeInTheDocument()
|
|
expect(screen.getByText('Products')).toBeInTheDocument()
|
|
})
|
|
})
|