Adding tests for page components
This commit is contained in:
parent
8b2ce32b75
commit
abe646cec8
@ -21,3 +21,4 @@ Component.propTypes = {
|
||||
};
|
||||
|
||||
export default translate()(Component);
|
||||
export { Component };
|
||||
|
14
src/pages/404/Component.test.js
Normal file
14
src/pages/404/Component.test.js
Normal 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();
|
||||
});
|
||||
});
|
18
src/pages/404/__snapshots__/Component.test.js.snap
Normal file
18
src/pages/404/__snapshots__/Component.test.js.snap
Normal 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>
|
||||
`;
|
13
src/pages/index/Component.test.js
Normal file
13
src/pages/index/Component.test.js
Normal 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();
|
||||
});
|
||||
});
|
44
src/pages/index/__snapshots__/Component.test.js.snap
Normal file
44
src/pages/index/__snapshots__/Component.test.js.snap
Normal 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>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user