Skip to content

Commit 9901818

Browse files
committed
Added more expected outputs
1 parent 0a38986 commit 9901818

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

test/ConnectedRouter.test.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ describe('ConnectedRouter', () => {
166166
},
167167
action: 'PUSH',
168168
}
169-
})
169+
})
170+
171+
expect(props.history.entries).toHaveLength(3)
170172

171173
store.dispatch({
172174
type: LOCATION_CHANGE,
@@ -179,8 +181,10 @@ describe('ConnectedRouter', () => {
179181
},
180182
action: 'PUSH',
181183
}
182-
})
183-
184+
})
185+
186+
expect(props.history.entries).toHaveLength(3)
187+
184188
store.dispatch({
185189
type: LOCATION_CHANGE,
186190
payload: {
@@ -208,8 +212,11 @@ describe('ConnectedRouter', () => {
208212
mount(
209213
<Provider store={store}>
210214
<ConnectedRouter
211-
stateCompareFunction={() => true}
212-
{...props} >
215+
stateCompareFunction={(a, b) => {
216+
return a === undefined || (a.foo === "baz" && b.foo === 'bar') ? true : false
217+
}}
218+
{...props}
219+
>
213220
<Route path="/" render={() => <div>Home</div>} />
214221
</ConnectedRouter>
215222
</Provider>
@@ -229,7 +236,9 @@ describe('ConnectedRouter', () => {
229236
},
230237
action: 'PUSH',
231238
}
232-
})
239+
})
240+
241+
expect(props.history.entries).toHaveLength(3)
233242

234243
store.dispatch({
235244
type: LOCATION_CHANGE,
@@ -244,7 +253,7 @@ describe('ConnectedRouter', () => {
244253
}
245254
})
246255

247-
expect(props.history.entries).toHaveLength(2)
256+
expect(props.history.entries).toHaveLength(3)
248257
})
249258

250259
it('only renders one time when mounted', () => {

0 commit comments

Comments
 (0)