Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit 379dc9c

Browse files
committed
Add back route action tests.
1 parent 08b3818 commit 379dc9c

File tree

3 files changed

+102
-5
lines changed

3 files changed

+102
-5
lines changed

test/createTests.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ import { createStore, combineReducers } from 'redux'
88

99
import syncHistoryWithStore from '../src/sync'
1010
import { routerReducer } from '../src/reducer'
11-
// import {
12-
// UPDATE_LOCATION,
13-
// push, replace, go, goBack, goForward,
14-
// routeActions
15-
// } from '../src/actions'
1611
// import routerMiddleware from '../src/middleware'
1712

1813
expect.extend({

test/node/actions.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/* eslint-env mocha */
2+
3+
import expect from 'expect'
4+
5+
import {
6+
UPDATE_LOCATION,
7+
push, replace, go, goBack, goForward
8+
} from '../../src/actions'
9+
10+
describe('routeActions', () => {
11+
12+
describe('push', () => {
13+
it('creates actions', () => {
14+
expect(push('/foo')).toEqual({
15+
type: UPDATE_LOCATION,
16+
payload: {
17+
method: 'push',
18+
args: [ '/foo' ]
19+
}
20+
})
21+
22+
expect(push({ pathname: '/foo', state: { the: 'state' } })).toEqual({
23+
type: UPDATE_LOCATION,
24+
payload: {
25+
method: 'push',
26+
args: [ {
27+
pathname: '/foo',
28+
state: { the: 'state' }
29+
} ]
30+
}
31+
})
32+
33+
expect(push('/foo', 'baz', 123)).toEqual({
34+
type: UPDATE_LOCATION,
35+
payload: {
36+
method: 'push',
37+
args: [ '/foo' , 'baz', 123 ]
38+
}
39+
})
40+
})
41+
})
42+
43+
describe('replace', () => {
44+
it('creates actions', () => {
45+
expect(replace('/foo')).toEqual({
46+
type: UPDATE_LOCATION,
47+
payload: {
48+
method: 'replace',
49+
args: [ '/foo' ]
50+
}
51+
})
52+
53+
expect(replace({ pathname: '/foo', state: { the: 'state' } })).toEqual({
54+
type: UPDATE_LOCATION,
55+
payload: {
56+
method: 'replace',
57+
args: [ {
58+
pathname: '/foo',
59+
state: { the: 'state' }
60+
} ]
61+
}
62+
})
63+
})
64+
})
65+
66+
describe('go', () => {
67+
it('creates actions', () => {
68+
expect(go(1)).toEqual({
69+
type: UPDATE_LOCATION,
70+
payload: {
71+
method: 'go',
72+
args: [ 1 ]
73+
}
74+
})
75+
})
76+
})
77+
78+
describe('goBack', () => {
79+
it('creates actions', () => {
80+
expect(goBack()).toEqual({
81+
type: UPDATE_LOCATION,
82+
payload: {
83+
method: 'goBack',
84+
args: []
85+
}
86+
})
87+
})
88+
})
89+
90+
describe('goForward', () => {
91+
it('creates actions', () => {
92+
expect(goForward()).toEqual({
93+
type: UPDATE_LOCATION,
94+
payload: {
95+
method: 'goForward',
96+
args: []
97+
}
98+
})
99+
})
100+
})
101+
102+
})
File renamed without changes.

0 commit comments

Comments
 (0)