forked from cartsnitch/app
fix(test): update App.test.tsx for ProtectedRoute redirect behavior
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
+17
-23
@@ -1,23 +1,17 @@
|
||||
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()
|
||||
})
|
||||
})
|
||||
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('redirects unauthenticated users to login', () => {
|
||||
render(<App />)
|
||||
expect(screen.getByText('CartSnitch')).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: /sign in/i })).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user