Skip to content

Instantly share code, notes, and snippets.

@Nicktho
Last active April 6, 2016 01:10
Show Gist options
  • Save Nicktho/3458a7f4dcd8d394d155f2c1d7856ee8 to your computer and use it in GitHub Desktop.
Save Nicktho/3458a7f4dcd8d394d155f2c1d7856ee8 to your computer and use it in GitHub Desktop.
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