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 // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PrivacyPolicy rendering 1`] = ` exports[`PrivacyPolicy rendering 1`] = `
<Message <DocumentFragment>
heading="TRANSLATE(Privacy Policy)" <span
onClose={[MockFunction]} data-component="Message"
type="info" data-props="{
> \\"type\\": \\"info\\",
<Trans \\"heading\\": \\"TRANSLATE(Privacy Policy)\\"
i18nKey="Privacy policy copy" }"
>
<span
data-component="Trans"
data-props="{
\\"i18nKey\\": \\"Privacy policy copy\\"
}"
> >
<p> <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 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> <p>
Regexper is not supported by ad revenue or sales of any kind. Regexper is not supported by ad revenue or sales of any kind.
</p> </p>
</Trans> </span>
</Message> </span>
</DocumentFragment>
`; `;

View File

@ -1,14 +1,17 @@
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 { PrivacyPolicy } from 'components/PrivacyPolicy'; import { PrivacyPolicy } from 'components/PrivacyPolicy';
describe('PrivacyPolicy', () => { describe('PrivacyPolicy', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const { asFragment } = render(
<PrivacyPolicy onClose={ jest.fn() } t={ mockT } /> <PrivacyPolicy onClose={ jest.fn() } t={ mockT } />
); );
expect(component).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();
}); });
}); });