Skip to content

Commit 57375c2

Browse files
committed
Test that identity of computedStates is preserved when possible
1 parent 878c5e4 commit 57375c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/instrument.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ describe('instrument', () => {
250250
monitoredStore.dispatch({ type: 'INCREMENT' });
251251
expect(reducerCalls).toBe(4);
252252

253+
let savedComputedStates = monitoredLiftedStore.getState().computedStates;
254+
253255
monitoredLiftedStore.dispatch(ActionCreators.jumpToState(0));
254256
expect(reducerCalls).toBe(4);
255257

@@ -258,6 +260,8 @@ describe('instrument', () => {
258260

259261
monitoredLiftedStore.dispatch(ActionCreators.jumpToState(3));
260262
expect(reducerCalls).toBe(4);
263+
264+
expect(monitoredLiftedStore.getState().computedStates).toBe(savedComputedStates);
261265
});
262266

263267

@@ -272,11 +276,15 @@ describe('instrument', () => {
272276
monitoredStore.dispatch({ type: 'INCREMENT' });
273277
expect(reducerCalls).toBe(4);
274278

279+
let savedComputedStates = monitoredLiftedStore.getState().computedStates;
280+
275281
monitoredLiftedStore.dispatch({ type: 'lol' });
276282
expect(reducerCalls).toBe(4);
277283

278284
monitoredLiftedStore.dispatch({ type: 'wat' });
279285
expect(reducerCalls).toBe(4);
286+
287+
expect(monitoredLiftedStore.getState().computedStates).toBe(savedComputedStates);
280288
});
281289

282290
describe('Import State', () => {

0 commit comments

Comments
 (0)