mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-11-04 09:57:26 +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) {
 | 
					  switch (action.type) {
 | 
				
			||||||
    case 'INCREMENT': return state + 1;
 | 
					    case 'INCREMENT': return state + 1;
 | 
				
			||||||
    case 'DECREMENT': return mistake - 1; // eslint-disable-line no-undef
 | 
					    case 'DECREMENT': return mistake - 1; // eslint-disable-line no-undef
 | 
				
			||||||
 | 
					    case 'SET_UNDEFINED': return undefined;
 | 
				
			||||||
    default: return state;
 | 
					    default: return state;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -202,18 +203,13 @@ describe('devTools', () => {
 | 
				
			||||||
    spy.restore();
 | 
					    spy.restore();
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('returns the last non-undefined state from getState', () => {
 | 
					  it('should return the last non-undefined state from getState', () => {
 | 
				
			||||||
    let spy = spyOn(console, 'error');
 | 
					    let storeWithBug = devTools()(createStore)(counterWithBug);
 | 
				
			||||||
 | 
					    storeWithBug.dispatch({ type: 'INCREMENT' });
 | 
				
			||||||
 | 
					    storeWithBug.dispatch({ type: 'INCREMENT' });
 | 
				
			||||||
 | 
					    expect(storeWithBug.getState()).toBe(2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    store.dispatch({ type: 'INCREMENT' });
 | 
					    storeWithBug.dispatch({ type: 'SET_UNDEFINED' });
 | 
				
			||||||
    store.dispatch({ type: 'DECREMENT' });
 | 
					    expect(storeWithBug.getState()).toBe(2);
 | 
				
			||||||
    store.dispatch({ type: 'INCREMENT' });
 | 
					 | 
				
			||||||
    store.dispatch({ type: 'INCREMENT' });
 | 
					 | 
				
			||||||
    expect(store.getState()).toBe(2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    store.replaceReducer(counterWithBug);
 | 
					 | 
				
			||||||
    expect(store.getState()).toBe(1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    spy.restore();
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user