Skip to content

Commit

Permalink
Migrate checkout state for editing and editOrder to local state using…
Browse files Browse the repository at this point in the history
… editing and setEditing
  • Loading branch information
sirugh committed Jun 12, 2019
1 parent 3ce9977 commit f666c8b
Show file tree
Hide file tree
Showing 9 changed files with 589 additions and 525 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import actions from '../actions';
import {
beginCheckout,
editOrder,
formatAddress,
getShippingMethods,
resetCheckout,
Expand Down Expand Up @@ -114,26 +113,6 @@ describe('resetCheckout', () => {
});
});

describe('editOrder', () => {
test('editOrder() returns a thunk', () => {
expect(editOrder()).toBeInstanceOf(Function);
});

test('editOrder thunk returns undefined', async () => {
const result = await editOrder()(...thunkArgs);

expect(result).toBeUndefined();
});

test('editOrder thunk dispatches actions', async () => {
const payload = 'PAYLOAD';
await editOrder(payload)(...thunkArgs);

expect(dispatch).toHaveBeenCalledWith(actions.edit(payload));
expect(dispatch).toHaveBeenCalledTimes(1);
});
});

describe('getShippingMethods', () => {
test('getShippingMethods() returns a thunk', () => {
expect(getShippingMethods()).toBeInstanceOf(Function);
Expand Down
5 changes: 0 additions & 5 deletions packages/venia-concept/src/actions/checkout/asyncActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ export const resetCheckout = () =>
dispatch(actions.reset());
};

export const editOrder = section =>
async function thunk(dispatch) {
dispatch(actions.edit(section));
};

export const getShippingMethods = () => {
return async function thunk(dispatch, getState) {
const { cart, user } = getState();
Expand Down
Loading

0 comments on commit f666c8b

Please sign in to comment.