Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import thunk from 'redux-thunk';
  2.  
  3. const mockStore = configureStore([ thunk ]);
  4.  
  5. describe('cart checkout', () => {
  6. it('should checkout cart', () => {
  7. const state = StateBuilder.new()
  8. .withItems(items)
  9. .withPaymentMethod()
  10. .build();
  11.  
  12. const store = mockStore(state);
  13.  
  14. return store.dispatch(checkout())
  15. .then(() => {
  16. expect(store.getActions()).to.contain({ type: 'CHECKOUT_SUCCESS' })
  17. })
  18.  
  19. })
  20.  
  21. it('should fail to checkout cart without items', () => {
  22. const state = StateBuilder.new()
  23. .withPaymentMethod()
  24. .build();
  25.  
  26. const store = mockStore(state);
  27.  
  28. return store.dispatch(checkout())
  29. .then(() => {
  30. expect(store.getActions()).to.contain({ type: 'CHECKOUT_FAILURE', error: new Error() })
  31. })
  32. })
  33. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement