Skip to content

Commit

Permalink
Add test to ensure optimist not in original reducer state
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Feb 28, 2018
1 parent 087cba9 commit 1682380
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,17 @@ basic('commit other transaction', {
}
});

test('omits optimist from original reducer', () => {
function originalReducer(state = {value: 0}, action) {
assert(state.value === 0);
assert(!state.hasOwnProperty('optimist'));
return state;
}
let reducer = optimist(originalReducer);
let state;
state = reducer(state, {type: 'foo'});
state = reducer(state, {type: 'foo'});
});

test('real world example', () => {
function originalReducer(state = {value: 0}, action) {
Expand Down

0 comments on commit 1682380

Please sign in to comment.