| 1 |
import '@testing-library/jest-dom'; |
| 2 |
import { screen } from '@testing-library/react'; |
| 3 |
import NotFound from '../../pages/NotFound'; |
| 4 |
import { renderWithProviders } from '../setup/helpers'; |
| 5 |
|
| 6 |
describe('NotFound', () => { |
| 7 |
it('renders the not found heading', () => { |
| 8 |
renderWithProviders(<NotFound />); |
| 9 |
|
| 10 |
expect(screen.getByText('Page not found')).toBeInTheDocument(); |
| 11 |
}); |
| 12 |
|
| 13 |
it('renders the description message', () => { |
| 14 |
renderWithProviders(<NotFound />); |
| 15 |
|
| 16 |
expect( |
| 17 |
screen.getByText( |
| 18 |
"The page you're looking for doesn't exist or has been moved." |
| 19 |
) |
| 20 |
).toBeInTheDocument(); |
| 21 |
}); |
| 22 |
|
| 23 |
it('renders a link back to the dashboard', () => { |
| 24 |
renderWithProviders(<NotFound />); |
| 25 |
|
| 26 |
const link = screen.getByText('Back to Dashboard'); |
| 27 |
expect(link).toBeInTheDocument(); |
| 28 |
expect(link.closest('a')).toHaveAttribute('href', '/'); |
| 29 |
}); |
| 30 |
}); |
| 31 |
|