Skip to content

Commit

Permalink
Add a performance regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Sep 27, 2015
1 parent b529260 commit 9f1e9c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/devTools.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,14 @@ describe('devTools', () => {
storeWithBug.dispatch({ type: 'SET_UNDEFINED' });
expect(storeWithBug.getState()).toBe(2);
});

it('should not recompute states on every action', () => {
let reducerCalls = 0;
let monitoredStore = devTools()(createStore)(() => reducerCalls++);
expect(reducerCalls).toBe(1);
monitoredStore.dispatch({ type: 'INCREMENT' });
monitoredStore.dispatch({ type: 'INCREMENT' });
monitoredStore.dispatch({ type: 'INCREMENT' });
expect(reducerCalls).toBe(4);
});
});

0 comments on commit 9f1e9c6

Please sign in to comment.