mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Add snapshot tests for pages
This commit is contained in:
parent
957f3c7d68
commit
90257a9fe9
6 changed files with 101 additions and 0 deletions
16
src/containers/HomePage/HomePage.test.js
Normal file
16
src/containers/HomePage/HomePage.test.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import React from 'react';
|
||||
import { BrowserRouter } from 'react-router';
|
||||
import renderer from 'react-test-renderer';
|
||||
import HomePage from './HomePage';
|
||||
|
||||
describe('HomePage', () => {
|
||||
it('matches snapshot', () => {
|
||||
const component = renderer.create(
|
||||
<BrowserRouter>
|
||||
<HomePage />
|
||||
</BrowserRouter>
|
||||
);
|
||||
const tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
15
src/containers/HomePage/__snapshots__/HomePage.test.js.snap
Normal file
15
src/containers/HomePage/__snapshots__/HomePage.test.js.snap
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
exports[`HomePage matches snapshot 1`] = `
|
||||
<div
|
||||
className={undefined}>
|
||||
<h1>
|
||||
Index page
|
||||
</h1>
|
||||
<a
|
||||
className=""
|
||||
href="/search"
|
||||
onClick={[Function]}
|
||||
style={Object {}}>
|
||||
search page
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
16
src/containers/NotFoundPage/NotFoundPage.test.js
Normal file
16
src/containers/NotFoundPage/NotFoundPage.test.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import React from 'react';
|
||||
import { BrowserRouter } from 'react-router';
|
||||
import renderer from 'react-test-renderer';
|
||||
import NotFoundPage from './NotFoundPage';
|
||||
|
||||
describe('NotFoundPage', () => {
|
||||
it('matches snapshot', () => {
|
||||
const component = renderer.create(
|
||||
<BrowserRouter>
|
||||
<NotFoundPage />
|
||||
</BrowserRouter>
|
||||
);
|
||||
const tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
exports[`NotFoundPage matches snapshot 1`] = `
|
||||
<div
|
||||
className={undefined}>
|
||||
<h1>
|
||||
Page not found
|
||||
</h1>
|
||||
<a
|
||||
className=""
|
||||
href="/"
|
||||
onClick={[Function]}
|
||||
style={Object {}}>
|
||||
index page
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
16
src/containers/SearchPage/SearchPage.test.js
Normal file
16
src/containers/SearchPage/SearchPage.test.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import React from 'react';
|
||||
import { BrowserRouter } from 'react-router';
|
||||
import renderer from 'react-test-renderer';
|
||||
import SearchPage from './SearchPage';
|
||||
|
||||
describe('SearchPage', () => {
|
||||
it('matches snapshot', () => {
|
||||
const component = renderer.create(
|
||||
<BrowserRouter>
|
||||
<SearchPage />
|
||||
</BrowserRouter>
|
||||
);
|
||||
const tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
exports[`SearchPage matches snapshot 1`] = `
|
||||
<div
|
||||
className={undefined}>
|
||||
<h1>
|
||||
Search page
|
||||
</h1>
|
||||
<a
|
||||
className=""
|
||||
href="/"
|
||||
onClick={[Function]}
|
||||
style={Object {}}>
|
||||
index page
|
||||
</a>
|
||||
<br />
|
||||
<a
|
||||
className=""
|
||||
href="/home"
|
||||
onClick={[Function]}
|
||||
style={Object {}}>
|
||||
home page
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
Loading…
Add table
Reference in a new issue