2019-04-30 11:11:25 +08:00
|
|
|
import React = require('react');
|
|
|
|
import NotFound from '../../src/components/404';
|
|
|
|
import * as renderer from 'react-test-renderer';
|
2021-08-18 20:25:51 +08:00
|
|
|
import '../../src/themes/default';
|
2021-06-03 13:05:35 +08:00
|
|
|
import {render, fireEvent, cleanup} from '@testing-library/react';
|
2019-04-30 11:11:25 +08:00
|
|
|
|
|
|
|
afterEach(cleanup);
|
|
|
|
|
|
|
|
test('Components:404 default View', () => {
|
2021-06-03 13:05:35 +08:00
|
|
|
const component = renderer.create(<NotFound />);
|
|
|
|
let tree = component.toJSON();
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2021-06-03 13:05:35 +08:00
|
|
|
expect(tree).toMatchSnapshot();
|
2019-04-30 11:11:25 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Components:404 Custom code & messages', () => {
|
2021-06-03 13:05:35 +08:00
|
|
|
const component = renderer.create(
|
|
|
|
<NotFound code={500} description="Internal Error" />
|
|
|
|
);
|
|
|
|
let tree = component.toJSON();
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2021-06-03 13:05:35 +08:00
|
|
|
expect(tree).toMatchSnapshot();
|
|
|
|
});
|