File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ function counterWithBug(state = 0, action) {
1414 switch ( action . type ) {
1515 case 'INCREMENT' : return state + 1 ;
1616 case 'DECREMENT' : return mistake - 1 ; // eslint-disable-line no-undef
17+ case 'SET_UNDEFINED' : return undefined ;
1718 default : return state ;
1819 }
1920}
@@ -202,18 +203,13 @@ describe('devTools', () => {
202203 spy . restore ( ) ;
203204 } ) ;
204205
205- it ( 'returns the last non-undefined state from getState' , ( ) => {
206- let spy = spyOn ( console , 'error' ) ;
207-
208- store . dispatch ( { type : 'INCREMENT' } ) ;
209- store . dispatch ( { type : 'DECREMENT' } ) ;
210- store . dispatch ( { type : 'INCREMENT' } ) ;
211- store . dispatch ( { type : 'INCREMENT' } ) ;
212- expect ( store . getState ( ) ) . toBe ( 2 ) ;
213-
214- store . replaceReducer ( counterWithBug ) ;
215- expect ( store . getState ( ) ) . toBe ( 1 ) ;
206+ it ( 'should return the last non-undefined state from getState' , ( ) => {
207+ let storeWithBug = devTools ( ) ( createStore ) ( counterWithBug ) ;
208+ storeWithBug . dispatch ( { type : 'INCREMENT' } ) ;
209+ storeWithBug . dispatch ( { type : 'INCREMENT' } ) ;
210+ expect ( storeWithBug . getState ( ) ) . toBe ( 2 ) ;
216211
217- spy . restore ( ) ;
212+ storeWithBug . dispatch ( { type : 'SET_UNDEFINED' } ) ;
213+ expect ( storeWithBug . getState ( ) ) . toBe ( 2 ) ;
218214 } ) ;
219215} ) ;
You can’t perform that action at this time.
0 commit comments