Last active
April 6, 2016 01:10
-
-
Save Nicktho/3458a7f4dcd8d394d155f2c1d7856ee8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('#dispatch', () => { | |
const reducer = (state = [ 'hello world' ], action) => { | |
switch(action.type) { | |
case 'ADD_NOTE': | |
return [ ...state, action.payload ]; | |
default: | |
return state; | |
} | |
}; | |
const addNote = payload => ({ type: 'ADD_NOTE', payload }); | |
it('should update the state with the result of the reducer', () => { | |
const store = createStore(reducer); | |
store.dispatch(addNote('hello')); | |
expect(store.getState()).to.deep.equal([ 'hello world', 'hello' ]); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment