Skip to content

Commit 25729fa

Browse files
committed
Add Patterns page snapshot tests
1 parent fcab10c commit 25729fa

File tree

2 files changed

+643
-0
lines changed

2 files changed

+643
-0
lines changed

__tests__/pages/Patterns.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import { MemoryRouter } from 'react-router-dom';
3+
import renderer from 'react-test-renderer';
4+
import { Provider } from 'react-redux';
5+
import configureMockStore from 'redux-mock-store';
6+
import 'jest-styled-components';
7+
import Patterns from '../../src/pages/Patterns';
8+
9+
const mockStore = configureMockStore();
10+
const store = mockStore({
11+
mode: 'dark'
12+
});
13+
14+
describe('Patterns page', () => {
15+
it('renders the Patterns list', () => {
16+
const tree = renderer
17+
.create(
18+
<MemoryRouter initialEntries={['/patterns']}>
19+
<Patterns />
20+
</MemoryRouter>
21+
)
22+
.toJSON();
23+
expect(tree).toMatchSnapshot();
24+
});
25+
26+
it('renders the individual Pattern (Singleton) info', () => {
27+
const tree = renderer
28+
.create(
29+
<MemoryRouter initialEntries={['/patterns/singleton']}>
30+
<Provider store={store}>
31+
<Patterns />
32+
</Provider>
33+
</MemoryRouter>
34+
)
35+
.toJSON();
36+
expect(tree).toMatchSnapshot();
37+
});
38+
});

0 commit comments

Comments
 (0)