Skip to content

Commit

Permalink
test: added test for 404
Browse files Browse the repository at this point in the history
  • Loading branch information
GOLASOOO committed Apr 29, 2024
1 parent e3c271f commit b1fd6a0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions webapp/src/tests/PageNotFound404.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { MemoryRouter } from 'react-router-dom';
import PageNotFound from '../pages/NotFound';
import theme from '../styles/theme';
import { ChakraProvider } from '@chakra-ui/react';

jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: key => key,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
}),
}));

describe('404 page', () => {
it('renders title and description correctly', () => {
const { getByText } = render(<ChakraProvider theme={theme}><MemoryRouter><PageNotFound /></MemoryRouter></ChakraProvider>);

expect(getByText('404 - Page not found')).toBeInTheDocument();
expect(getByText('Woops! You seem lost! Click on go back to find your way.')).toBeInTheDocument();
});
});

0 comments on commit b1fd6a0

Please sign in to comment.