Skip to content

Commit

Permalink
test(cartaction): test against "payload" property
Browse files Browse the repository at this point in the history
also use ActionType on CartActionType

improves #34, #35
  • Loading branch information
aneurysmjs committed Sep 29, 2019
1 parent 1fadb62 commit cfbafeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/app/shared/types/CartType.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// @flow strict
import type { Action } from 'redux';
import type { ActionType } from '@/shared/types/CommonType';

export type CartType = {
quantity: number
};

export type CartActionType = {
...$Exact<Action<string>>,
...$Exact<CartType>
};
export type CartActionType = ActionType<CartType>;
2 changes: 1 addition & 1 deletion src/app/store/modules/cart/reducers/cart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('cart reducer', () => {
};

it('should return initial state', () => {
const initialState = cart(undefined, { type: '', quantity: 0 });
const initialState = cart(undefined, { type: '', payload: { quantity: 0 } });

expect(initialState).toStrictEqual(expectedState);
});
Expand Down

0 comments on commit cfbafeb

Please sign in to comment.