Reworking internal component naming for clarity

This commit is contained in:
Jeff Avallone 2019-01-06 13:25:33 -05:00
parent 618b21bb93
commit bf35f26d5b
22 changed files with 79 additions and 243 deletions

View File

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Footer rendering implementation 1`] = ` exports[`Footer rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <FooterImpl Symbol(enzyme.__unrendered__): <Footer
site={ site={
Object { Object {
"siteMetadata": Object { "siteMetadata": Object {
@ -488,77 +488,3 @@ ShallowWrapper {
}, },
} }
`; `;
exports[`Footer rendering with query 1`] = `
ShallowWrapper {
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <Footer />,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"getNode": [Function],
"render": [Function],
"simulateError": [Function],
"simulateEvent": [Function],
"unmount": [Function],
},
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {
"query": "
query FooterQuery {
site {
siteMetadata {
buildId
}
}
}
",
"render": [Function],
},
"ref": null,
"rendered": null,
"type": [MockFunction],
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {
"query": "
query FooterQuery {
site {
siteMetadata {
buildId
}
}
}
",
"render": [Function],
},
"ref": null,
"rendered": null,
"type": [MockFunction],
},
],
Symbol(enzyme.__options__): Object {
"adapter": ReactSixteenAdapter {
"options": Object {
"enableComponentDidUpdateOnSetState": true,
"lifecycles": Object {
"componentDidUpdate": Object {
"onSetState": true,
},
"getDerivedStateFromProps": true,
"getSnapshotBeforeUpdate": true,
"setState": Object {
"skipsComponentDidUpdateOnNullish": true,
},
},
},
},
},
}
`;

View File

@ -15,7 +15,7 @@ const query = graphql`
} }
`; `;
export const FooterImpl = ({ t, site: { siteMetadata } }) => ( export const Footer = ({ t, site: { siteMetadata } }) => (
<footer className={ style.footer }> <footer className={ style.footer }>
<ul className={ style.list }> <ul className={ style.list }>
<li> <li>
@ -38,7 +38,7 @@ export const FooterImpl = ({ t, site: { siteMetadata } }) => (
</footer> </footer>
); );
FooterImpl.propTypes = { Footer.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
site: PropTypes.shape({ site: PropTypes.shape({
siteMetadata: PropTypes.shape({ siteMetadata: PropTypes.shape({
@ -47,9 +47,8 @@ FooterImpl.propTypes = {
}).isRequired }).isRequired
}; };
const TranslatedFooter = withNamespaces()(FooterImpl); export default withNamespaces()(props => (
const Footer = () => <StaticQuery query={ query } render={ data => ( <StaticQuery query={ query } render={ data => (
<TranslatedFooter { ...data } /> <Footer { ...props } { ...data } />
) } />; ) } />
));
export default Footer;

View File

@ -2,19 +2,12 @@ import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { mockT } from 'i18n'; import { mockT } from 'i18n';
import Footer, { FooterImpl } from 'components/Footer'; import { Footer } from 'components/Footer';
describe('Footer', () => { describe('Footer', () => {
test('rendering with query', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<Footer /> <Footer site={{ siteMetadata: { buildId: 'abc-123' } }} t={ mockT } />
);
expect(component).toMatchSnapshot();
});
test('rendering implementation', () => {
const component = shallow(
<FooterImpl site={{ siteMetadata: { buildId: 'abc-123' } }} t={ mockT } />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });

View File

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Header rendering implementation 1`] = ` exports[`Header rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <HeaderImpl Symbol(enzyme.__unrendered__): <Header
site={ site={
Object { Object {
"siteMetadata": Object { "siteMetadata": Object {
@ -61,7 +61,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li> </li>
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li> </li>
</ul>, </ul>,
], ],
@ -127,7 +127,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li>, </li>,
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li>, </li>,
], ],
"className": "list", "className": "list",
@ -247,7 +247,7 @@ ShallowWrapper {
"key": undefined, "key": undefined,
"nodeType": "host", "nodeType": "host",
"props": Object { "props": Object {
"children": <LoadNamespace(LocaleSwitcherImpl) />, "children": <LoadNamespace(LocaleSwitcher) />,
}, },
"ref": null, "ref": null,
"rendered": Object { "rendered": Object {
@ -309,7 +309,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li> </li>
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li> </li>
</ul>, </ul>,
], ],
@ -375,7 +375,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li>, </li>,
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li>, </li>,
], ],
"className": "list", "className": "list",
@ -495,7 +495,7 @@ ShallowWrapper {
"key": undefined, "key": undefined,
"nodeType": "host", "nodeType": "host",
"props": Object { "props": Object {
"children": <LoadNamespace(LocaleSwitcherImpl) />, "children": <LoadNamespace(LocaleSwitcher) />,
}, },
"ref": null, "ref": null,
"rendered": Object { "rendered": Object {
@ -536,10 +536,10 @@ ShallowWrapper {
} }
`; `;
exports[`Header rendering implementation with no banner 1`] = ` exports[`Header rendering with no banner 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <HeaderImpl Symbol(enzyme.__unrendered__): <Header
site={ site={
Object { Object {
"siteMetadata": Object { "siteMetadata": Object {
@ -597,7 +597,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li> </li>
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li> </li>
</ul>, </ul>,
], ],
@ -663,7 +663,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li>, </li>,
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li>, </li>,
], ],
"className": "list", "className": "list",
@ -783,7 +783,7 @@ ShallowWrapper {
"key": undefined, "key": undefined,
"nodeType": "host", "nodeType": "host",
"props": Object { "props": Object {
"children": <LoadNamespace(LocaleSwitcherImpl) />, "children": <LoadNamespace(LocaleSwitcher) />,
}, },
"ref": null, "ref": null,
"rendered": Object { "rendered": Object {
@ -845,7 +845,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li> </li>
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li> </li>
</ul>, </ul>,
], ],
@ -911,7 +911,7 @@ ShallowWrapper {
</mockConstructor> </mockConstructor>
</li>, </li>,
<li> <li>
<LoadNamespace(LocaleSwitcherImpl) /> <LoadNamespace(LocaleSwitcher) />
</li>, </li>,
], ],
"className": "list", "className": "list",
@ -1031,7 +1031,7 @@ ShallowWrapper {
"key": undefined, "key": undefined,
"nodeType": "host", "nodeType": "host",
"props": Object { "props": Object {
"children": <LoadNamespace(LocaleSwitcherImpl) />, "children": <LoadNamespace(LocaleSwitcher) />,
}, },
"ref": null, "ref": null,
"rendered": Object { "rendered": Object {
@ -1071,77 +1071,3 @@ ShallowWrapper {
}, },
} }
`; `;
exports[`Header rendering with query 1`] = `
ShallowWrapper {
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <Header />,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"getNode": [Function],
"render": [Function],
"simulateError": [Function],
"simulateEvent": [Function],
"unmount": [Function],
},
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {
"query": "
query HeaderQuery {
site {
siteMetadata {
banner
}
}
}
",
"render": [Function],
},
"ref": null,
"rendered": null,
"type": [MockFunction],
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "function",
"props": Object {
"query": "
query HeaderQuery {
site {
siteMetadata {
banner
}
}
}
",
"render": [Function],
},
"ref": null,
"rendered": null,
"type": [MockFunction],
},
],
Symbol(enzyme.__options__): Object {
"adapter": ReactSixteenAdapter {
"options": Object {
"enableComponentDidUpdateOnSetState": true,
"lifecycles": Object {
"componentDidUpdate": Object {
"onSetState": true,
},
"getDerivedStateFromProps": true,
"getSnapshotBeforeUpdate": true,
"setState": Object {
"skipsComponentDidUpdateOnNullish": true,
},
},
},
},
},
}
`;

View File

@ -19,7 +19,7 @@ const query = graphql`
} }
`; `;
export const HeaderImpl = ({ site: { siteMetadata } }) => ( export const Header = ({ site: { siteMetadata } }) => (
<header <header
className={ style.header } className={ style.header }
data-banner={ siteMetadata.banner || null }> data-banner={ siteMetadata.banner || null }>
@ -48,7 +48,7 @@ export const HeaderImpl = ({ site: { siteMetadata } }) => (
</header> </header>
); );
HeaderImpl.propTypes = { Header.propTypes = {
site: PropTypes.shape({ site: PropTypes.shape({
siteMetadata: PropTypes.shape({ siteMetadata: PropTypes.shape({
banner: PropTypes.oneOfType([ banner: PropTypes.oneOfType([
@ -59,9 +59,8 @@ HeaderImpl.propTypes = {
}).isRequired }).isRequired
}; };
const TranslatedHeader = withNamespaces()(HeaderImpl); export default withNamespaces()(props => (
const Header = () => <StaticQuery query={ query } render={ data => ( <StaticQuery query={ query } render={ data => (
<TranslatedHeader { ...data } /> <Header { ...props } { ...data } />
) } />; ) } />
));
export default Header;

View File

@ -1,26 +1,19 @@
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import Header, { HeaderImpl } from 'components/Header'; import { Header } from 'components/Header';
describe('Header', () => { describe('Header', () => {
test('rendering with query', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<Header /> <Header site={{ siteMetadata: { banner: 'testing' } }} />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });
test('rendering implementation', () => { test('rendering with no banner', () => {
const component = shallow( const component = shallow(
<HeaderImpl site={{ siteMetadata: { banner: 'testing' } }} /> <Header site={{ siteMetadata: { banner: false } }} />
);
expect(component).toMatchSnapshot();
});
test('rendering implementation with no banner', () => {
const component = shallow(
<HeaderImpl site={{ siteMetadata: { banner: false } }} />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });

View File

@ -20,11 +20,11 @@ ShallowWrapper {
"nodeType": "class", "nodeType": "class",
"props": Object { "props": Object {
"children": Array [ "children": Array [
<Header />, <LoadNamespace(Component) />,
<SentryBoundary> <SentryBoundary>
Example content Example content
</SentryBoundary>, </SentryBoundary>,
<Footer />, <LoadNamespace(Component) />,
], ],
}, },
"ref": null, "ref": null,
@ -32,7 +32,7 @@ ShallowWrapper {
Object { Object {
"instance": null, "instance": null,
"key": undefined, "key": undefined,
"nodeType": "function", "nodeType": "class",
"props": Object {}, "props": Object {},
"ref": null, "ref": null,
"rendered": null, "rendered": null,
@ -52,7 +52,7 @@ ShallowWrapper {
Object { Object {
"instance": null, "instance": null,
"key": undefined, "key": undefined,
"nodeType": "function", "nodeType": "class",
"props": Object {}, "props": Object {},
"ref": null, "ref": null,
"rendered": null, "rendered": null,
@ -68,11 +68,11 @@ ShallowWrapper {
"nodeType": "class", "nodeType": "class",
"props": Object { "props": Object {
"children": Array [ "children": Array [
<Header />, <LoadNamespace(Component) />,
<SentryBoundary> <SentryBoundary>
Example content Example content
</SentryBoundary>, </SentryBoundary>,
<Footer />, <LoadNamespace(Component) />,
], ],
}, },
"ref": null, "ref": null,
@ -80,7 +80,7 @@ ShallowWrapper {
Object { Object {
"instance": null, "instance": null,
"key": undefined, "key": undefined,
"nodeType": "function", "nodeType": "class",
"props": Object {}, "props": Object {},
"ref": null, "ref": null,
"rendered": null, "rendered": null,
@ -100,7 +100,7 @@ ShallowWrapper {
Object { Object {
"instance": null, "instance": null,
"key": undefined, "key": undefined,
"nodeType": "function", "nodeType": "class",
"props": Object {}, "props": Object {},
"ref": null, "ref": null,
"rendered": null, "rendered": null,

View File

@ -3,7 +3,7 @@
exports[`LocaleSwitcher rendering 1`] = ` exports[`LocaleSwitcher rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <LocaleSwitcherImpl />, Symbol(enzyme.__unrendered__): <LocaleSwitcher />,
Symbol(enzyme.__renderer__): Object { Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function], "batchedUpdates": [Function],
"getNode": [Function], "getNode": [Function],

View File

@ -21,7 +21,7 @@ const localeToAvailable = (locale, available, defaultLocale) => {
return defaultLocale; return defaultLocale;
}; };
export class LocaleSwitcherImpl extends React.PureComponent { export class LocaleSwitcher extends React.PureComponent {
state = { state = {
current: localeToAvailable( current: localeToAvailable(
i18n.language || '', i18n.language || '',
@ -64,4 +64,4 @@ export class LocaleSwitcherImpl extends React.PureComponent {
} }
} }
export default withNamespaces()(LocaleSwitcherImpl); export default withNamespaces()(LocaleSwitcher);

View File

@ -2,12 +2,12 @@ import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import i18n from 'i18n'; import i18n from 'i18n';
import { LocaleSwitcherImpl } from 'components/LocaleSwitcher'; import { LocaleSwitcher } from 'components/LocaleSwitcher';
describe('LocaleSwitcher', () => { describe('LocaleSwitcher', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<LocaleSwitcherImpl /> <LocaleSwitcher />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });
@ -16,7 +16,7 @@ describe('LocaleSwitcher', () => {
jest.spyOn(i18n, 'changeLanguage'); jest.spyOn(i18n, 'changeLanguage');
const component = shallow( const component = shallow(
<LocaleSwitcherImpl /> <LocaleSwitcher />
); );
const selectInput = component.find('select'); const selectInput = component.find('select');
selectInput.value = 'other'; selectInput.value = 'other';

View File

@ -3,7 +3,7 @@
exports[`SentryError rendering 1`] = ` exports[`SentryError rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <SentryErrorImpl Symbol(enzyme.__unrendered__): <SentryError
t={[Function]} t={[Function]}
/>, />,
Symbol(enzyme.__renderer__): Object { Symbol(enzyme.__renderer__): Object {

View File

@ -5,7 +5,7 @@ import { withNamespaces, Trans } from 'react-i18next';
import Message from 'components/Message'; import Message from 'components/Message';
export class SentryErrorImpl extends React.Component { export class SentryError extends React.Component {
reportError = event => { reportError = event => {
event.preventDefault(); event.preventDefault();
@ -26,8 +26,8 @@ export class SentryErrorImpl extends React.Component {
} }
} }
SentryErrorImpl.propTypes = { SentryError.propTypes = {
t: PropTypes.func.isRequired t: PropTypes.func.isRequired
}; };
export default withNamespaces()(SentryErrorImpl); export default withNamespaces()(SentryError);

View File

@ -5,12 +5,12 @@ import { shallow } from 'enzyme';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { mockT } from 'i18n'; import { mockT } from 'i18n';
import { SentryErrorImpl } from 'components/SentryError'; import { SentryError } from 'components/SentryError';
describe('SentryError', () => { describe('SentryError', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<SentryErrorImpl t={ mockT }/> <SentryError t={ mockT }/>
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });
@ -19,7 +19,7 @@ describe('SentryError', () => {
test('fill out a report when an event has been logged', () => { test('fill out a report when an event has been logged', () => {
Sentry.lastEventId.mockReturnValue(1); Sentry.lastEventId.mockReturnValue(1);
const component = shallow( const component = shallow(
<SentryErrorImpl t={ mockT } /> <SentryError t={ mockT } />
); );
const eventObj = { preventDefault: jest.fn() }; const eventObj = { preventDefault: jest.fn() };
component.find('a').simulate('click', eventObj); component.find('a').simulate('click', eventObj);
@ -31,7 +31,7 @@ describe('SentryError', () => {
test('fill out a report when an event has not been logged', () => { test('fill out a report when an event has not been logged', () => {
Sentry.lastEventId.mockReturnValue(false); Sentry.lastEventId.mockReturnValue(false);
const component = shallow( const component = shallow(
<SentryErrorImpl t={ mockT } /> <SentryError t={ mockT } />
); );
const eventObj = { preventDefault: jest.fn() }; const eventObj = { preventDefault: jest.fn() };
component.find('a').simulate('click', eventObj); component.find('a').simulate('click', eventObj);

View File

@ -5,15 +5,15 @@ import { withNamespaces, Trans } from 'react-i18next';
import Metadata from 'components/Metadata'; import Metadata from 'components/Metadata';
import Message from 'components/Message'; import Message from 'components/Message';
export const ErrorPageImpl = ({ t }) => <> export const ErrorPage = ({ t }) => <>
<Metadata title={ t('Page Not Found') } /> <Metadata title={ t('Page Not Found') } />
<Message type="error" heading={ t('404 Page Not Found') }> <Message type="error" heading={ t('404 Page Not Found') }>
<p><Trans>The page you have requested could not be found.</Trans></p> <p><Trans>The page you have requested could not be found.</Trans></p>
</Message> </Message>
</>; </>;
ErrorPageImpl.propTypes = { ErrorPage.propTypes = {
t: PropTypes.func.isRequired t: PropTypes.func.isRequired
}; };
export default withNamespaces()(ErrorPageImpl); export default withNamespaces()(ErrorPage);

View File

@ -2,12 +2,12 @@ import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { mockT } from 'i18n'; import { mockT } from 'i18n';
import { ErrorPageImpl } from 'pages/404'; import { ErrorPage } from 'pages/404';
describe('Error Page', () => { describe('Error Page', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<ErrorPageImpl t={ mockT } /> <ErrorPage t={ mockT } />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });

View File

@ -3,7 +3,7 @@
exports[`Error Page rendering 1`] = ` exports[`Error Page rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <ErrorPageImpl Symbol(enzyme.__unrendered__): <ErrorPage
t={[Function]} t={[Function]}
/>, />,
Symbol(enzyme.__renderer__): Object { Symbol(enzyme.__renderer__): Object {

View File

@ -3,7 +3,7 @@
exports[`Index Page rendering 1`] = ` exports[`Index Page rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <IndexPageImpl />, Symbol(enzyme.__unrendered__): <IndexPage />,
Symbol(enzyme.__renderer__): Object { Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function], "batchedUpdates": [Function],
"getNode": [Function], "getNode": [Function],

View File

@ -3,7 +3,7 @@
exports[`Privacy Page rendering 1`] = ` exports[`Privacy Page rendering 1`] = `
ShallowWrapper { ShallowWrapper {
Symbol(enzyme.__root__): [Circular], Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <PrivacyPageImpl Symbol(enzyme.__unrendered__): <PrivacyPage
t={[Function]} t={[Function]}
/>, />,
Symbol(enzyme.__renderer__): Object { Symbol(enzyme.__renderer__): Object {

View File

@ -5,7 +5,7 @@ import { withNamespaces, Trans } from 'react-i18next';
import Metadata from 'components/Metadata'; import Metadata from 'components/Metadata';
import Message from 'components/Message'; import Message from 'components/Message';
export const IndexPageImpl = () => <> export const IndexPage = () => <>
<Metadata/> <Metadata/>
<noscript> <noscript>
<Message type="error" heading="JavaScript Required"> <Message type="error" heading="JavaScript Required">
@ -17,4 +17,4 @@ export const IndexPageImpl = () => <>
<div><Trans>Hello world</Trans></div> <div><Trans>Hello world</Trans></div>
</>; </>;
export default withNamespaces()(IndexPageImpl); export default withNamespaces()(IndexPage);

View File

@ -1,12 +1,12 @@
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { IndexPageImpl } from 'pages/index'; import { IndexPage } from 'pages/index';
describe('Index Page', () => { describe('Index Page', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<IndexPageImpl /> <IndexPage />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });

View File

@ -5,7 +5,7 @@ import { withNamespaces, Trans } from 'react-i18next';
import Metadata from 'components/Metadata'; import Metadata from 'components/Metadata';
import Message from 'components/Message'; import Message from 'components/Message';
export const PrivacyPageImpl = ({ t }) => <> export const PrivacyPage = ({ t }) => <>
<Metadata title={ t('Privacy Policy') } /> <Metadata title={ t('Privacy Policy') } />
<Message type="info" heading={ t('Privacy Policy') }> <Message type="info" heading={ t('Privacy Policy') }>
<Trans i18nKey="Privacy policy copy"> <Trans i18nKey="Privacy policy copy">
@ -49,8 +49,8 @@ export const PrivacyPageImpl = ({ t }) => <>
</Message> </Message>
</>; </>;
PrivacyPageImpl.propTypes = { PrivacyPage.propTypes = {
t: PropTypes.func.isRequired t: PropTypes.func.isRequired
}; };
export default withNamespaces()(PrivacyPageImpl); export default withNamespaces()(PrivacyPage);

View File

@ -2,12 +2,12 @@ import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import { mockT } from 'i18n'; import { mockT } from 'i18n';
import { PrivacyPageImpl } from 'pages/privacy'; import { PrivacyPage } from 'pages/privacy';
describe('Privacy Page', () => { describe('Privacy Page', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const component = shallow(
<PrivacyPageImpl t={ mockT } /> <PrivacyPage t={ mockT } />
); );
expect(component).toMatchSnapshot(); expect(component).toMatchSnapshot();
}); });