Skip to content

Commit

Permalink
Merge branch 'develop' into aws-pr-test-build-bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatil-magento committed Apr 24, 2019
2 parents 62dc0ac + 0d812ea commit 9871e35
Show file tree
Hide file tree
Showing 27 changed files with 1,448 additions and 1,332 deletions.
2 changes: 1 addition & 1 deletion packages/peregrine/src/RestApi/Magento2/MulticastCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Resource matching is determined by a string composite [method, path, body].
*
* (M2ApiRequests know not to use this cache for create operations, except for
* singleton create operations like createGuestCart, which have no body.)
* singleton create operations like createCart, which have no body.)
* @module MulticastCache
*/

Expand Down
10 changes: 8 additions & 2 deletions packages/venia-concept/src/RootComponents/Product/Product.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { string, func } from 'prop-types';

import { connect, Query } from 'src/drivers';
import { addItemToCart } from 'src/actions/cart';
Expand All @@ -15,9 +16,14 @@ import productQuery from 'src/queries/getProductDetail.graphql';
* TODO: Replace with a single product query when possible.
*/
class Product extends Component {
static propTypes = {
addItemToCart: func.isRequired,
cartId: string
};

addToCart = async (item, quantity) => {
const { guestCartId } = this.props;
await this.props.addItemToCart({ guestCartId, item, quantity });
const { addItemToCart, cartId } = this.props;
await addItemToCart({ cartId, item, quantity });
};

componentDidMount() {
Expand Down
28 changes: 12 additions & 16 deletions packages/venia-concept/src/actions/cart/__tests__/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,28 @@ test('removeItem.receive() returns a proper action object', () => {
});
});

test('getGuestCart.request.toString() returns the proper action type', () => {
expect(actions.getGuestCart.request.toString()).toBe(
'CART/GET_GUEST_CART/REQUEST'
);
test('getCart.request.toString() returns the proper action type', () => {
expect(actions.getCart.request.toString()).toBe('CART/GET_CART/REQUEST');
});

test('getGuestCart.request() returns a proper action object', () => {
expect(actions.getGuestCart.request(payload)).toEqual({
type: 'CART/GET_GUEST_CART/REQUEST',
test('getCart.request() returns a proper action object', () => {
expect(actions.getCart.request(payload)).toEqual({
type: 'CART/GET_CART/REQUEST',
payload
});
});

test('getGuestCart.receive.toString() returns the proper action type', () => {
expect(actions.getGuestCart.receive.toString()).toBe(
'CART/GET_GUEST_CART/RECEIVE'
);
test('getCart.receive.toString() returns the proper action type', () => {
expect(actions.getCart.receive.toString()).toBe('CART/GET_CART/RECEIVE');
});

test('getGuestCart.receive() returns a proper action object', () => {
expect(actions.getGuestCart.receive(payload)).toEqual({
type: 'CART/GET_GUEST_CART/RECEIVE',
test('getCart.receive() returns a proper action object', () => {
expect(actions.getCart.receive(payload)).toEqual({
type: 'CART/GET_CART/RECEIVE',
payload
});
expect(actions.getGuestCart.receive(error)).toEqual({
type: 'CART/GET_GUEST_CART/RECEIVE',
expect(actions.getCart.receive(error)).toEqual({
type: 'CART/GET_CART/RECEIVE',
payload: error,
error: true
});
Expand Down
Loading

0 comments on commit 9871e35

Please # to comment.