Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import thunk from 'redux-thunk';
- const mockStore = configureStore([ thunk ]);
- describe('cart checkout', () => {
- it('should checkout cart', () => {
- const state = StateBuilder.new()
- .withItems(items)
- .withPaymentMethod()
- .build();
- const store = mockStore(state);
- return store.dispatch(checkout())
- .then(() => {
- expect(store.getActions()).to.contain({ type: 'CHECKOUT_SUCCESS' })
- })
- })
- it('should fail to checkout cart without items', () => {
- const state = StateBuilder.new()
- .withPaymentMethod()
- .build();
- const store = mockStore(state);
- return store.dispatch(checkout())
- .then(() => {
- expect(store.getActions()).to.contain({ type: 'CHECKOUT_FAILURE', error: new Error() })
- })
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement