captains-log/frontend/app/routes/home.test.tsx
Drew Galbraith 5fcdcef449
All checks were successful
Check / Backend (push) Successful in 14m25s
Check / Frontend (push) Successful in 2m1s
Fix typecheck. (#14)
Reviewed-on: #14
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
2025-09-27 09:13:00 +00:00

43 lines
1.1 KiB
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, it, expect } from 'vitest'
import { MemoryRouter } from 'react-router'
import Home from './home'
import type { Route } from './+types/home'
describe('Home component', () => {
it('should render task management interface', () => {
const mockComponentProps: Route.ComponentProps = {
loaderData: { tasks: [] },
params: {},
matches: [
{
id: 'root',
params: {},
pathname: '/',
data: undefined,
loaderData: undefined,
handle: undefined,
},
{
id: 'routes/home',
params: {},
pathname: '/',
data: { tasks: [] },
loaderData: { tasks: [] },
handle: undefined,
},
],
}
render(
<MemoryRouter>
<Home {...mockComponentProps} />
</MemoryRouter>
)
expect(
screen.getByRole('heading', { level: 1, name: /Dashboard/i })
).toBeInTheDocument()
// TaskList component should be rendered with empty state
expect(screen.getByText(/No tasks found/i)).toBeInTheDocument()
})
})