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

Commit 226a4e2

Browse files
committed
Add test for custom selectRouterState
1 parent 5f01ab9 commit 226a4e2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

scratch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
const store = createStore(combineReducers({
3+
notRouting: routeReducer
4+
}));
5+
const history = createHistory();
6+
syncReduxAndRouter(history, store, state => state.notRouting)
7+
history.pushState(null, '/bar');
8+
expect(store.getState().notRouting.path).toEqual('/bar');

test/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,14 @@ describe('syncReduxAndRouter', () => {
194194
() => syncReduxAndRouter(history, store)
195195
).toThrow(/Cannot sync router: route state does not exist/);
196196
});
197+
198+
it('accepts custom selectRouterState', () => {
199+
const store = createStore(combineReducers({
200+
notRouting: routeReducer
201+
}));
202+
const history = createHistory();
203+
syncReduxAndRouter(history, store, state => state.notRouting)
204+
history.pushState(null, '/bar');
205+
expect(store.getState().notRouting.path).toEqual('/bar');
206+
});
197207
});

0 commit comments

Comments
 (0)