1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-05-18 01:11:36 +07:00
verdaccio-ui/src/components/NotFound/Notfound.test.tsx

31 lines
790 B
TypeScript

import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { render, fireEvent } from '../../utils/test-react-testing-library';
import NotFound from './NotFound';
describe('<NotFound /> component', () => {
test('should load the component in default state', () => {
const { container } = render(
<Router>
<NotFound />
</Router>
);
expect(container.firstChild).toMatchSnapshot();
});
test('go to Home Page button click', async () => {
const spy = jest.spyOn(React, 'useCallback');
const { getByTestId } = render(
<Router>
<NotFound />
</Router>
);
const node = getByTestId('not-found-go-to-home-button');
fireEvent.click(node);
expect(spy).toHaveBeenCalled();
});
});