Updating PrivacyPolicy to use react-testing-library

This commit is contained in:
Jeff Avallone 2019-03-24 13:02:22 -04:00
parent 9f15287fcc
commit ced6c42c3d
2 changed files with 60 additions and 50 deletions

View File

@ -1,13 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PrivacyPolicy rendering 1`] = `
<Message
heading="TRANSLATE(Privacy Policy)"
onClose={[MockFunction]}
type="info"
>
<Trans
i18nKey="Privacy policy copy"
<DocumentFragment>
<span
data-component="Message"
data-props="{
\\"type\\": \\"info\\",
\\"heading\\": \\"TRANSLATE(Privacy Policy)\\"
}"
>
<span
data-component="Trans"
data-props="{
\\"i18nKey\\": \\"Privacy policy copy\\"
}"
>
<p>
Regexper and the tools used to create it are all open source. If you are concerned that the JavaScript being delivered is in any way malicious, please inspect the source in the
@ -51,6 +57,7 @@ exports[`PrivacyPolicy rendering 1`] = `
<p>
Regexper is not supported by ad revenue or sales of any kind.
</p>
</Trans>
</Message>
</span>
</span>
</DocumentFragment>
`;

View File

@ -1,14 +1,17 @@
jest.mock('components/Message', () =>
require('__mocks__/component-mock')('components/Message'));
import React from 'react';
import { shallow } from 'enzyme';
import { render } from 'react-testing-library';
import { mockT } from 'i18n';
import { PrivacyPolicy } from 'components/PrivacyPolicy';
describe('PrivacyPolicy', () => {
test('rendering', () => {
const component = shallow(
const { asFragment } = render(
<PrivacyPolicy onClose={ jest.fn() } t={ mockT } />
);
expect(component).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
});