-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.js
43 lines (37 loc) · 870 Bytes
/
test.js
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
import Immutable from 'seamless-immutable';
import createReducer from '../../creators/createReducer';
import onCancel from '.';
const initialState = {
target: null,
targetLoading: true,
targetError: null,
targetRetryCount: 0,
targetTimeoutID: null,
targetIsRetrying: false
};
const setUp = {
state: null
};
beforeEach(() => {
setUp.state = Immutable(initialState);
});
describe('onCancel', () => {
it('Sets targets', () => {
const reducer = createReducer(setUp.state, {
'@@ACTION/TYPE': onCancel()
});
const newState = reducer(setUp.state, {
type: '@@ACTION/TYPE',
target: 'target',
payload: 1
});
expect(newState).toEqual({
target: null,
targetLoading: false,
targetError: null,
targetRetryCount: 0,
targetTimeoutID: null,
targetIsRetrying: false
});
});
});