Skip to content

Commit

Permalink
test(cartaction): update test against "payload" property
Browse files Browse the repository at this point in the history
improves #35
  • Loading branch information
aneurysmjs committed Sep 27, 2019
1 parent 26a482f commit c3de5e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/store/modules/cart/actions/cartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import * as types from '@/store/ActionTypes';

import { makeActionCreator } from '@/store/helpers/makeActionCreator';

export default makeActionCreator(types.CART_DATA, 'cart');
export default makeActionCreator(types.CART_DATA);
7 changes: 4 additions & 3 deletions src/app/store/modules/cart/actions/cartAction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import cartAction from './cartAction';

describe('cartAction action', () => {
it('should return the quantity', () => {
it('should return cart object', () => {
const quantity = 0;
const expectedData = { type: 'CART_DATA', cart: { quantity } };
expect(cartAction({ quantity })).toEqual(expectedData);
const payload = { cart: { quantity } };
const expectedData = { type: 'CART_DATA', payload };
expect(cartAction(payload)).toEqual(expectedData);
});
});

0 comments on commit c3de5e0

Please sign in to comment.