Updating privacy page to use react-testing-library

This commit is contained in:
Jeff Avallone 2019-03-24 13:01:03 -04:00
parent 5d700f47aa
commit 9f15287fcc
2 changed files with 19 additions and 8 deletions

View File

@ -1,10 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Privacy Page rendering 1`] = `
<Fragment>
<withI18nextTranslation(Metadata)
title="TRANSLATE(Privacy Policy)"
<DocumentFragment>
<span
data-component="withI18nextTranslation(Metadata)"
data-props="{
\\"title\\": \\"TRANSLATE(Privacy Policy)\\"
}"
/>
<withI18nextTranslation(PrivacyPolicy) />
</Fragment>
<span
data-component="withI18nextTranslation(PrivacyPolicy)"
data-props="{}"
/>
</DocumentFragment>
`;

View File

@ -1,14 +1,19 @@
jest.mock('components/Metadata', () =>
require('__mocks__/component-mock')('components/Metadata'));
jest.mock('components/PrivacyPolicy', () =>
require('__mocks__/component-mock')('components/PrivacyPolicy'));
import React from 'react';
import { shallow } from 'enzyme';
import { render } from 'react-testing-library';
import { mockT } from 'i18n';
import { PrivacyPage } from 'pages/privacy';
describe('Privacy Page', () => {
test('rendering', () => {
const component = shallow(
const { asFragment } = render(
<PrivacyPage t={ mockT } />
);
expect(component).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
});