This repository was archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathAbout.spec.jsx
More file actions
51 lines (42 loc) · 1.29 KB
/
About.spec.jsx
File metadata and controls
51 lines (42 loc) · 1.29 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import {Provider} from 'react-redux';
import {shallow, mount, render} from 'enzyme';
import configureStore from 'redux-mock-store';
import MetaAction from '../../../src/stores/meta/MetaAction';
import About from '../../../src/views/about/About';
describe('About', () => {
const initialState = {};
const mockStore = configureStore();
let store;
let wrapper;
let component;
beforeEach(() => {
store = mockStore(initialState);
wrapper = mount(
<Provider store={store}>
<About />
</Provider>
);
component = wrapper.find(About).first();
});
test('should match mapStateToProps', () => {
// TODO: how to test mapStateToProps
});
test('should call setMeta action', () => {
const actions = store.getActions();
const actual = actions[0];
const expected = {
type: MetaAction.SET_META,
payload: {
title: 'About Page',
},
};
expect(actual).toEqual(expected);
});
test('should call X number of actions', () => {
const actions = store.getActions();
const actual = actions.length;
const expected = 1;
expect(actual).toBe(expected);
});
});