Adding tests for page components

This commit is contained in:
Jeff Avallone 2018-02-15 17:35:59 -05:00
parent 8b2ce32b75
commit abe646cec8
5 changed files with 90 additions and 0 deletions

View File

@ -21,3 +21,4 @@ Component.propTypes = {
};
export default translate()(Component);
export { Component };

View File

@ -0,0 +1,14 @@
import React from 'react';
import { shallow } from 'enzyme';
import { translate } from 'i18n';
import { Component } from './Component';
describe('404 page component', () => {
test('rendering', () => {
const component = shallow(
<Component t={ translate }/>
);
expect(component).toMatchSnapshot();
});
});

View File

@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`404 page component rendering 1`] = `
<React.Fragment>
<Translate(Header) />
<Message
heading="translate(404 Page Not Found)"
type="error"
>
<p>
<Trans>
The page you have requested could not be found
</Trans>
</p>
</Message>
<Translate(Footer) />
</React.Fragment>
`;

View File

@ -0,0 +1,13 @@
import React from 'react';
import { shallow } from 'enzyme';
import Component from './Component';
describe('Index page component', () => {
test('rendering', () => {
const component = shallow(
<Component/>
);
expect(component).toMatchSnapshot();
});
});

View File

@ -0,0 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Index page component rendering 1`] = `
<React.Fragment>
<Translate(Header) />
<noscript>
<Message
heading="JavaScript Required"
icon={[Function]}
type="error"
>
<p>
You need to enable JavaScript to use Regexper.
</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 by following the GitHub link in the header. There are two data collection tools integrated in the app:
</p>
<ul>
<li>
<b>
Google Analytics
</b>
is used to track browser usage data and application performance.
</li>
<li>
<b>
Sentry.io
</b>
is a tool used to capture and report client-side JavaScript errors.
</li>
</ul>
<p>
Most popular ad blockers will prevent these tools from sending any tracking data, and doing so will
<b>
not
</b>
impact the performance of this app. Regexper is not supported by ad revenue or sales of any kind. The information collected by these tools is used to monitor application performance, determine browser support, and collect error reports.
</p>
</Message>
</noscript>
<App />
<Translate(Footer) />
</React.Fragment>
`;