Last active
June 20, 2016 16:20
-
-
Save c089/5808a500f41eb83122f25cb6c2d90990 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// together: | |
const asyncEnhancer = // depends on your middleware and how you inject dependencies | |
const store = createStore(reducer, undefined, asyncEnhancer); | |
store.dispatch(myAsyncAction()).then(() => { | |
expect(mySelector(store.getState())).toEqual('foo'); | |
}); | |
// or separate: | |
describe('async action', () => { | |
it('dispatches action1 and action2', () => { | |
// depends on your async middleware and how you inject dependencies for that | |
}); | |
}); | |
describe('reducer', () => { | |
it('does foo when receiving action1 and action2', () => { | |
const actions = [action1(), action2()]; | |
const state = actions.reduce(reducer, undefined); | |
expect(mySelector(state))).toEqual('foo'); | |
}); | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment