Updating 404 page to use react-testing-library
This commit is contained in:
parent
58dc36b0c6
commit
5d700f47aa
@ -1,14 +1,19 @@
|
|||||||
|
jest.mock('components/Metadata', () =>
|
||||||
|
require('__mocks__/component-mock')('components/Metadata'));
|
||||||
|
jest.mock('components/Message', () =>
|
||||||
|
require('__mocks__/component-mock')('components/Message'));
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { render } from 'react-testing-library';
|
||||||
|
|
||||||
import { mockT } from 'i18n';
|
import { mockT } from 'i18n';
|
||||||
import { ErrorPage } from 'pages/404';
|
import { ErrorPage } from 'pages/404';
|
||||||
|
|
||||||
describe('Error Page', () => {
|
describe('Error Page', () => {
|
||||||
test('rendering', () => {
|
test('rendering', () => {
|
||||||
const component = shallow(
|
const { asFragment } = render(
|
||||||
<ErrorPage t={ mockT } />
|
<ErrorPage t={ mockT } />
|
||||||
);
|
);
|
||||||
expect(component).toMatchSnapshot();
|
expect(asFragment()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,19 +1,28 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Error Page rendering 1`] = `
|
exports[`Error Page rendering 1`] = `
|
||||||
<Fragment>
|
<DocumentFragment>
|
||||||
<withI18nextTranslation(Metadata)
|
<span
|
||||||
title="TRANSLATE(Page Not Found)"
|
data-component="withI18nextTranslation(Metadata)"
|
||||||
|
data-props="{
|
||||||
|
\\"title\\": \\"TRANSLATE(Page Not Found)\\"
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
<Message
|
<span
|
||||||
heading="TRANSLATE(404 Page Not Found)"
|
data-component="Message"
|
||||||
type="error"
|
data-props="{
|
||||||
|
\\"type\\": \\"error\\",
|
||||||
|
\\"heading\\": \\"TRANSLATE(404 Page Not Found)\\"
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<Trans>
|
<span
|
||||||
|
data-component="Trans"
|
||||||
|
data-props="{}"
|
||||||
|
>
|
||||||
The page you have requested could not be found.
|
The page you have requested could not be found.
|
||||||
</Trans>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</Message>
|
</span>
|
||||||
</Fragment>
|
</DocumentFragment>
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user