mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 01:26:48 +03:00
improve code coverage on devTools.js
This commit is contained in:
parent
d157963ceb
commit
eb9ecb1e65
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user