diff --git a/test/devTools.spec.js b/test/devTools.spec.js index dbfe0c58..672fb8b9 100644 --- a/test/devTools.spec.js +++ b/test/devTools.spec.js @@ -14,6 +14,7 @@ function counterWithBug(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1; case 'DECREMENT': return mistake - 1; // eslint-disable-line no-undef + case 'SET_UNDEFINED': return undefined; default: return state; } } @@ -202,18 +203,13 @@ describe('devTools', () => { spy.restore(); }); - it('returns the last non-undefined state from getState', () => { - let spy = spyOn(console, 'error'); + it('should return the last non-undefined state from getState', () => { + let storeWithBug = devTools()(createStore)(counterWithBug); + storeWithBug.dispatch({ type: 'INCREMENT' }); + storeWithBug.dispatch({ type: 'INCREMENT' }); + expect(storeWithBug.getState()).toBe(2); - store.dispatch({ type: 'INCREMENT' }); - store.dispatch({ type: 'DECREMENT' }); - store.dispatch({ type: 'INCREMENT' }); - store.dispatch({ type: 'INCREMENT' }); - expect(store.getState()).toBe(2); - - store.replaceReducer(counterWithBug); - expect(store.getState()).toBe(1); - - spy.restore(); + storeWithBug.dispatch({ type: 'SET_UNDEFINED' }); + expect(storeWithBug.getState()).toBe(2); }); });