@@ -12,7 +12,7 @@ expect.extend({
12
12
search = '' ,
13
13
hash = '' ,
14
14
state = null ,
15
- query = { } ,
15
+ query,
16
16
action = 'PUSH'
17
17
} ) {
18
18
const { locationBeforeTransitions } = this . actual . getState ( ) . routing
@@ -28,19 +28,19 @@ expect.extend({
28
28
} )
29
29
30
30
31
- function createSyncedHistoryAndStore ( testHistory ) {
31
+ function createSyncedHistoryAndStore ( originalHistory ) {
32
32
33
33
const store = createStore ( combineReducers ( {
34
34
routing : routerReducer
35
35
} ) )
36
- const history = syncHistoryWithStore ( testHistory , store )
36
+ const history = syncHistoryWithStore ( originalHistory , store )
37
37
38
38
return { history, store }
39
39
}
40
40
41
41
const defaultReset = ( ) => { }
42
42
43
- export default function createTests ( testHistory , name , reset = defaultReset ) {
43
+ export default function createTests ( createHistory , name , reset = defaultReset ) {
44
44
describe ( name , ( ) => {
45
45
46
46
beforeEach ( reset )
@@ -49,7 +49,7 @@ export default function createTests(testHistory, name, reset = defaultReset) {
49
49
let history , store
50
50
51
51
beforeEach ( ( ) => {
52
- let synced = createSyncedHistoryAndStore ( testHistory )
52
+ let synced = createSyncedHistoryAndStore ( createHistory ( ) )
53
53
history = synced . history
54
54
store = synced . store
55
55
} )
@@ -58,7 +58,7 @@ export default function createTests(testHistory, name, reset = defaultReset) {
58
58
history . unsubscribe ( )
59
59
} )
60
60
61
- it ( 'syncs router -> redux' , ( ) => {
61
+ it ( 'syncs history -> redux' , ( ) => {
62
62
expect ( store ) . toContainLocation ( {
63
63
pathname : '/' ,
64
64
action : 'POP'
@@ -91,8 +91,7 @@ export default function createTests(testHistory, name, reset = defaultReset) {
91
91
history . push ( '/bar?query=1' )
92
92
expect ( store ) . toContainLocation ( {
93
93
pathname : '/bar' ,
94
- search : '?query=1' ,
95
- query : { query : '1' }
94
+ search : '?query=1'
96
95
} )
97
96
98
97
history . push ( '/bar#baz' )
@@ -109,7 +108,6 @@ export default function createTests(testHistory, name, reset = defaultReset) {
109
108
expect ( store ) . toContainLocation ( {
110
109
pathname : '/bar' ,
111
110
search : '?query=1' ,
112
- query : { query : '1' } ,
113
111
state : { bar : 'baz' } ,
114
112
action : 'REPLACE'
115
113
} )
@@ -123,7 +121,6 @@ export default function createTests(testHistory, name, reset = defaultReset) {
123
121
expect ( store ) . toContainLocation ( {
124
122
pathname : '/bar' ,
125
123
search : '?query=1' ,
126
- query : { query : '1' } ,
127
124
hash : '#hash=2' ,
128
125
state : { bar : 'baz' } ,
129
126
action : 'REPLACE'
@@ -163,11 +160,13 @@ export default function createTests(testHistory, name, reset = defaultReset) {
163
160
} )
164
161
165
162
describe ( 'Redux DevTools' , ( ) => {
166
- let history , store , devToolsStore
163
+ let originalHistory , history , store , devToolsStore
167
164
168
165
beforeEach ( ( ) => {
166
+ originalHistory = createHistory ( )
167
+
169
168
// Set initial URL before syncing
170
- testHistory . push ( '/foo' )
169
+ originalHistory . push ( '/foo' )
171
170
172
171
store = createStore (
173
172
combineReducers ( {
@@ -177,7 +176,7 @@ export default function createTests(testHistory, name, reset = defaultReset) {
177
176
)
178
177
devToolsStore = store . liftedStore
179
178
180
- history = syncHistoryWithStore ( testHistory , store )
179
+ history = syncHistoryWithStore ( originalHistory , store )
181
180
} )
182
181
183
182
afterEach ( ( ) => {
0 commit comments