forked from zoltantothcom/Design-Patterns-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatterns.test.js
More file actions
38 lines (35 loc) · 1012 Bytes
/
Copy pathPatterns.test.js
File metadata and controls
38 lines (35 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import renderer from 'react-test-renderer';
import { Provider } from 'react-redux';
import configureMockStore from 'redux-mock-store';
import 'jest-styled-components';
import Patterns from '../../src/pages/Patterns';
const mockStore = configureMockStore();
const store = mockStore({
mode: 'dark'
});
describe('Patterns page', () => {
it('renders the Patterns list', () => {
const tree = renderer
.create(
<MemoryRouter initialEntries={['/patterns']}>
<Patterns />
</MemoryRouter>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders the individual Pattern (Singleton) info', () => {
const tree = renderer
.create(
<MemoryRouter initialEntries={['/patterns/singleton']}>
<Provider store={store}>
<Patterns />
</Provider>
</MemoryRouter>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
});