@shopgate/pwa-common-commerce 7.30.0-alpha.7 → 7.30.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cart/action-creators/addCouponsToCart.js +9 -2
- package/cart/action-creators/addProductsToCart.js +9 -2
- package/cart/action-creators/deleteCouponsFromCart.js +9 -2
- package/cart/action-creators/deleteProductsFromCart.js +9 -2
- package/cart/action-creators/errorAddCouponsToCart.js +10 -2
- package/cart/action-creators/errorAddProductsToCart.js +10 -2
- package/cart/action-creators/errorCart.js +8 -2
- package/cart/action-creators/errorDeleteCouponsFromCart.js +10 -2
- package/cart/action-creators/errorDeleteProductsFromCart.js +10 -2
- package/cart/action-creators/errorUpdateProductsInCart.js +10 -2
- package/cart/action-creators/receiveCart.js +9 -2
- package/cart/action-creators/requestCart.js +8 -2
- package/cart/action-creators/setCartProductPendingCount.js +9 -2
- package/cart/action-creators/setCouponFieldError.js +9 -2
- package/cart/action-creators/setCouponFieldValue.js +9 -2
- package/cart/action-creators/setFulfillmentSlot.js +9 -2
- package/cart/action-creators/successAddCouponsToCart.js +10 -2
- package/cart/action-creators/successAddProductsToCart.js +8 -2
- package/cart/action-creators/successDeleteCouponsFromCart.js +8 -2
- package/cart/action-creators/successDeleteProductsFromCart.js +8 -2
- package/cart/action-creators/successUpdateProductsInCart.js +8 -2
- package/cart/action-creators/updateProductsInCart.js +9 -2
- package/cart/actions/addCouponsToCart.js +52 -8
- package/cart/actions/addProductsToCart.js +80 -11
- package/cart/actions/deleteCouponsFromCart.js +39 -6
- package/cart/actions/deleteProductsFromCart.js +38 -6
- package/cart/actions/fetchCart.js +52 -8
- package/cart/actions/updateProductsInCart.js +44 -6
- package/cart/constants/PipelineErrors.js +6 -1
- package/cart/constants/Pipelines.js +6 -1
- package/cart/constants/Portals.js +85 -1
- package/cart/constants/index.js +39 -2
- package/cart/helpers/config.js +47 -2
- package/cart/helpers/createPipelineErrorList.js +30 -4
- package/cart/helpers/fulfillmentSlots.js +37 -4
- package/cart/helpers/index.js +14 -3
- package/cart/helpers/quantity.js +23 -4
- package/cart/helpers/shipping.js +57 -2
- package/cart/helpers/tax.js +26 -2
- package/cart/index.js +25 -5
- package/cart/mock.js +130 -1
- package/cart/reducers/couponField.js +30 -2
- package/cart/reducers/data.js +98 -6
- package/cart/reducers/index.js +7 -1
- package/cart/selectors/index.js +181 -31
- package/cart/selectors/spec.js +189 -2
- package/cart/streams/index.js +176 -29
- package/cart/subscriptions/index.js +307 -30
- package/category/action-creators/errorCategory.js +10 -2
- package/category/action-creators/errorCategoryChildren.js +9 -2
- package/category/action-creators/errorRootCategories.js +8 -2
- package/category/action-creators/receiveCategory.js +12 -2
- package/category/action-creators/receiveCategoryChildren.js +10 -2
- package/category/action-creators/receiveRootCategories.js +9 -2
- package/category/action-creators/requestCategory.js +9 -2
- package/category/action-creators/requestCategoryChildren.js +9 -2
- package/category/action-creators/requestRootCategories.js +8 -2
- package/category/actions/fetchCategory.js +47 -5
- package/category/actions/fetchCategoryChildren.js +30 -2
- package/category/actions/fetchCategoryOrRootCategories.js +16 -2
- package/category/actions/fetchCategoryProducts.js +36 -2
- package/category/actions/fetchRootCategories.js +31 -2
- package/category/actions/getCategory.js +10 -2
- package/category/constants/Pipelines.js +3 -1
- package/category/constants/Portals.js +56 -3
- package/category/constants/index.js +17 -2
- package/category/helpers/index.js +27 -3
- package/category/index.js +19 -5
- package/category/mock.js +176 -1
- package/category/reducers/categoriesById.js +65 -3
- package/category/reducers/childrenByCategoryId.js +55 -4
- package/category/reducers/helpers/handleCategoryCollection.js +24 -3
- package/category/reducers/helpers/handleReceivedCategories.js +3 -1
- package/category/reducers/index.js +12 -2
- package/category/reducers/rootCategories.js +31 -2
- package/category/selectors/index.js +115 -16
- package/category/streams/index.js +82 -4
- package/category/subscriptions/index.js +96 -3
- package/checkout/action-creators/successCheckout.js +9 -2
- package/checkout/actions/fetchCheckoutUrl.js +28 -3
- package/checkout/constants/Pipelines.js +1 -1
- package/checkout/constants/index.js +3 -2
- package/checkout/index.js +11 -4
- package/checkout/selectors/index.js +7 -2
- package/checkout/streams/index.js +8 -2
- package/checkout/subscriptions/index.js +35 -6
- package/favorites/action-creators/index.js +206 -24
- package/favorites/actions/addFavorites.js +41 -3
- package/favorites/actions/addFavoritesList.js +27 -2
- package/favorites/actions/fetchFavoriteIds.js +49 -5
- package/favorites/actions/fetchFavorites.js +60 -5
- package/favorites/actions/fetchFavoritesList.js +47 -3
- package/favorites/actions/fetchFavoritesListsWithItems.js +32 -3
- package/favorites/actions/getFavorites.js +6 -2
- package/favorites/actions/removeFavorites.js +32 -3
- package/favorites/actions/removeFavoritesList.js +24 -2
- package/favorites/actions/toggleFavorites.js +68 -10
- package/favorites/actions/updateFavorites.js +39 -3
- package/favorites/actions/updateFavoritesList.js +26 -2
- package/favorites/constants/Pipelines.js +9 -1
- package/favorites/constants/Portals.js +32 -4
- package/favorites/constants/index.js +37 -5
- package/favorites/index.js +14 -4
- package/favorites/mock.js +89 -4
- package/favorites/reducers/index.js +7 -1
- package/favorites/reducers/lists.js +74 -2
- package/favorites/reducers/products.js +231 -24
- package/favorites/selectors/index.js +188 -24
- package/favorites/streams/index.js +135 -23
- package/favorites/streams/spec.js +517 -8
- package/favorites/subscriptions/index.js +260 -25
- package/favorites/subscriptions/spec.js +701 -28
- package/filter/action-creators/errorFilters.js +9 -2
- package/filter/action-creators/index.js +4 -1
- package/filter/action-creators/receiveFilters.js +10 -2
- package/filter/action-creators/requestFilters.js +9 -2
- package/filter/action-creators/updateFilters.js +8 -2
- package/filter/actions/fetchFilters.js +46 -3
- package/filter/actions/getFilters.js +6 -2
- package/filter/actions/helpers/buildFilterParams.js +34 -2
- package/filter/actions/helpers/buildRequestFilters.js +35 -2
- package/filter/actions/helpers/processFilters.js +10 -2
- package/filter/actions/helpers/processParams.js +26 -2
- package/filter/constants/Pipelines.js +1 -1
- package/filter/constants/Portals.js +39 -3
- package/filter/constants/index.js +8 -1
- package/filter/index.js +12 -4
- package/filter/reducers/helpers/enrichFilters.js +11 -3
- package/filter/reducers/index.js +5 -1
- package/filter/reducers/resultsByHash.js +43 -3
- package/filter/selectors/index.js +47 -6
- package/filter/streams/index.js +30 -1
- package/filter/subscriptions/index.js +34 -2
- package/market/constants/Portals.js +22 -4
- package/market/constants/index.js +2 -1
- package/market/helpers/showReturnPolicy.js +3 -1
- package/market/helpers/showTaxDisclaimer.js +3 -1
- package/market/index.js +6 -2
- package/orders/constants.js +2 -1
- package/package.json +3 -3
- package/product/action-creators/deleteProductsByIds.js +10 -2
- package/product/action-creators/errorProduct.js +10 -2
- package/product/action-creators/errorProductDescription.js +10 -2
- package/product/action-creators/errorProductImages.js +10 -2
- package/product/action-creators/errorProductMedia.js +10 -2
- package/product/action-creators/errorProductOptions.js +10 -2
- package/product/action-creators/errorProductProperties.js +10 -2
- package/product/action-creators/errorProductRelations.js +9 -2
- package/product/action-creators/errorProductShipping.js +10 -2
- package/product/action-creators/errorProductVariants.js +10 -2
- package/product/action-creators/errorProducts.js +9 -2
- package/product/action-creators/expireProductById.js +10 -2
- package/product/action-creators/expireProductData.js +11 -2
- package/product/action-creators/expireProductsByHash.js +9 -2
- package/product/action-creators/productNotAvailable.js +10 -2
- package/product/action-creators/provideProduct.js +9 -2
- package/product/action-creators/receiveProduct.js +10 -2
- package/product/action-creators/receiveProductCached.js +9 -2
- package/product/action-creators/receiveProductDescription.js +10 -2
- package/product/action-creators/receiveProductImages.js +10 -2
- package/product/action-creators/receiveProductMedia.js +10 -2
- package/product/action-creators/receiveProductOptions.js +10 -2
- package/product/action-creators/receiveProductProperties.js +10 -2
- package/product/action-creators/receiveProductRelations.js +12 -2
- package/product/action-creators/receiveProductShipping.js +10 -2
- package/product/action-creators/receiveProductVariants.js +10 -2
- package/product/action-creators/receiveProducts.js +16 -2
- package/product/action-creators/receiveProductsCached.js +9 -2
- package/product/action-creators/refreshExpiredPDPData.js +8 -2
- package/product/action-creators/requestProduct.js +10 -2
- package/product/action-creators/requestProductDescription.js +9 -2
- package/product/action-creators/requestProductImages.js +9 -2
- package/product/action-creators/requestProductMedia.js +9 -2
- package/product/action-creators/requestProductOptions.js +9 -2
- package/product/action-creators/requestProductProperties.js +9 -2
- package/product/action-creators/requestProductRelations.js +10 -2
- package/product/action-creators/requestProductShipping.js +9 -2
- package/product/action-creators/requestProductVariants.js +9 -2
- package/product/action-creators/requestProducts.js +9 -2
- package/product/action-creators/setProductId.js +9 -2
- package/product/action-creators/setProductQuantity.js +9 -2
- package/product/action-creators/setProductVariantId.js +9 -2
- package/product/actions/changeSortOrder.js +21 -2
- package/product/actions/fetchHighlightProducts.js +18 -2
- package/product/actions/fetchLiveshoppingProducts.js +14 -2
- package/product/actions/fetchProduct.js +52 -3
- package/product/actions/fetchProductDescription.js +30 -2
- package/product/actions/fetchProductImages.js +31 -2
- package/product/actions/fetchProductMedia.js +35 -2
- package/product/actions/fetchProductOptions.js +31 -2
- package/product/actions/fetchProductProperties.js +30 -2
- package/product/actions/fetchProductRelations.js +63 -2
- package/product/actions/fetchProductShipping.js +31 -2
- package/product/actions/fetchProductVariants.js +31 -2
- package/product/actions/fetchProducts.js +189 -17
- package/product/actions/fetchProductsById.js +68 -8
- package/product/actions/fetchProductsByQuery.js +102 -18
- package/product/actions/getHighlightProducts.js +6 -2
- package/product/actions/getLiveshoppingProducts.js +6 -2
- package/product/actions/getProduct.js +6 -2
- package/product/actions/getProductDescription.js +6 -2
- package/product/actions/getProductImages.js +6 -2
- package/product/actions/getProductOptions.js +6 -2
- package/product/actions/getProductProperties.js +6 -2
- package/product/actions/getProductRelations.js +6 -2
- package/product/actions/getProductShipping.js +6 -2
- package/product/actions/getProductVariants.js +6 -2
- package/product/actions/getProducts.js +6 -2
- package/product/actions/getProductsById.js +6 -2
- package/product/actions/getProductsByQuery.js +6 -2
- package/product/actions/processProductFlags.js +35 -3
- package/product/actions/updateMetadata.js +17 -2
- package/product/collections/ProductImageFormats.js +48 -8
- package/product/collections/index.js +1 -1
- package/product/constants/Pipelines.js +12 -1
- package/product/constants/Portals.js +200 -33
- package/product/constants/index.js +90 -18
- package/product/helpers/index.js +61 -8
- package/product/index.js +36 -6
- package/product/mock.js +1002 -2
- package/product/reducers/descriptionsByProductId.js +54 -5
- package/product/reducers/helpers/formatOptions.js +17 -2
- package/product/reducers/helpers/handleProductCollection.js +19 -2
- package/product/reducers/imagesByProductId.js +51 -4
- package/product/reducers/index.js +23 -1
- package/product/reducers/mediaByProductId.js +55 -3
- package/product/reducers/optionsByProductId.js +41 -2
- package/product/reducers/productRelationsByHash.js +43 -2
- package/product/reducers/productsById.js +122 -7
- package/product/reducers/propertiesByProductId.js +48 -2
- package/product/reducers/resultsByHash.js +125 -9
- package/product/reducers/shippingByProductId.js +37 -2
- package/product/reducers/variantsByProductId.js +56 -2
- package/product/selectors/options.js +90 -13
- package/product/selectors/page.js +62 -13
- package/product/selectors/price.js +81 -18
- package/product/selectors/product.js +549 -59
- package/product/selectors/product.mock.js +327 -12
- package/product/selectors/relations.js +35 -5
- package/product/selectors/variants.js +91 -15
- package/product/streams/index.js +167 -13
- package/product/subscriptions/index.js +210 -4
- package/reviews/action-creators/errorProductReviews.js +9 -2
- package/reviews/action-creators/errorReviews.js +9 -2
- package/reviews/action-creators/errorSubmitReview.js +9 -2
- package/reviews/action-creators/errorUserReview.js +9 -2
- package/reviews/action-creators/flushUserReview.js +8 -2
- package/reviews/action-creators/receiveProductReviews.js +11 -2
- package/reviews/action-creators/receiveReviews.js +12 -2
- package/reviews/action-creators/receiveSubmitReview.js +9 -2
- package/reviews/action-creators/receiveUserReview.js +10 -2
- package/reviews/action-creators/requestProductReviews.js +10 -2
- package/reviews/action-creators/requestReviews.js +9 -2
- package/reviews/action-creators/requestSubmitReview.js +9 -2
- package/reviews/action-creators/requestUserReview.js +9 -2
- package/reviews/action-creators/resetSubmittedReview.js +9 -2
- package/reviews/action-creators/spec.js +40 -1
- package/reviews/actions/fetchProductReviews.js +37 -2
- package/reviews/actions/fetchReviews.js +38 -2
- package/reviews/actions/fetchUserReview.js +31 -2
- package/reviews/actions/flushUserReview.js +5 -1
- package/reviews/actions/getProductReviews.js +6 -2
- package/reviews/actions/getUserReview.js +6 -2
- package/reviews/actions/spec.js +241 -4
- package/reviews/actions/submitReview.js +63 -3
- package/reviews/constants/Pipelines.js +4 -1
- package/reviews/constants/Portals.js +4 -1
- package/reviews/constants/index.js +26 -7
- package/reviews/index.js +15 -4
- package/reviews/mock.js +172 -11
- package/reviews/reducers/index.js +11 -1
- package/reviews/reducers/mock.js +14 -2
- package/reviews/reducers/reviewsByHash.js +52 -6
- package/reviews/reducers/reviewsById.js +27 -2
- package/reviews/reducers/reviewsByProductId.js +47 -2
- package/reviews/reducers/spec.js +211 -2
- package/reviews/reducers/userReviewsByProductId.js +68 -2
- package/reviews/selectors/index.js +123 -19
- package/reviews/selectors/mock.js +100 -1
- package/reviews/selectors/spec.js +100 -1
- package/reviews/streams/index.js +37 -5
- package/reviews/streams/spec.js +25 -1
- package/reviews/subscriptions/index.js +27 -2
- package/scanner/action-creators/errorHandleScanner.js +11 -2
- package/scanner/action-creators/scannerFinished.js +11 -2
- package/scanner/action-creators/startScanner.js +8 -2
- package/scanner/action-creators/successHandleScanner.js +11 -2
- package/scanner/actions/handleBarCode.js +22 -2
- package/scanner/actions/handleNoResults.js +23 -2
- package/scanner/actions/handleQrCode.js +116 -6
- package/scanner/actions/handleSearch.js +33 -2
- package/scanner/constants/Portals.js +22 -1
- package/scanner/constants/index.js +17 -1
- package/scanner/helpers/index.js +115 -5
- package/scanner/index.js +19 -5
- package/scanner/streams/index.js +36 -1
- package/scanner/subscriptions/index.js +78 -8
- package/search/action-creators/errorSearchResults.js +10 -2
- package/search/action-creators/receiveSearchResults.js +11 -2
- package/search/action-creators/receiveSearchSuggestions.js +10 -2
- package/search/action-creators/requestSearchResults.js +10 -2
- package/search/action-creators/requestSearchSuggestions.js +9 -2
- package/search/actions/fetchSearchResults.js +66 -8
- package/search/actions/fetchSearchSuggestions.js +36 -2
- package/search/constants/Pipelines.js +1 -1
- package/search/constants/Portals.js +9 -2
- package/search/constants/index.js +10 -2
- package/search/helpers/index.js +5 -2
- package/search/helpers/removeHighlightingPlaceholders.js +4 -1
- package/search/helpers/spec.js +19 -1
- package/search/index.js +17 -5
- package/search/reducers/index.js +38 -2
- package/search/selectors/index.js +23 -4
- package/search/streams/index.js +51 -3
- package/search/subscriptions/index.js +132 -5
package/reviews/index.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// ACTIONS
|
|
2
|
-
export{default as fetchProductReviews
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
2
|
+
export { default as fetchProductReviews } from "./actions/fetchProductReviews";
|
|
3
|
+
export { default as fetchReviews } from "./actions/fetchReviews";
|
|
4
|
+
export { default as fetchUserReview } from "./actions/fetchUserReview";
|
|
5
|
+
export { default as flushUserReview } from "./actions/flushUserReview";
|
|
6
|
+
export { default as submitReview } from "./actions/submitReview";
|
|
7
|
+
|
|
8
|
+
// CONSTANTS
|
|
9
|
+
export * from "./constants/index";
|
|
10
|
+
export * from "./constants/Pipelines";
|
|
11
|
+
|
|
12
|
+
// SELECTORS
|
|
13
|
+
export * from "./selectors";
|
|
14
|
+
|
|
15
|
+
// STREAMS
|
|
16
|
+
export * from "./streams";
|
package/reviews/mock.js
CHANGED
|
@@ -1,30 +1,191 @@
|
|
|
1
|
-
|
|
1
|
+
import { themeConfig as mockedConfig } from '@shopgate/pwa-common/helpers/config/mock';
|
|
2
|
+
const mockProductId = 'foo';
|
|
3
|
+
const hash = `{"filters":{},"pipeline":"shopgate.catalog.getProductReviews","productId":"${mockProductId}"}`;
|
|
4
|
+
|
|
5
|
+
/**
|
|
2
6
|
* Get a reviews state.
|
|
3
7
|
* @param {Array} ids Fake review IDs.
|
|
4
8
|
* @param {string} _hash The review hash.
|
|
5
9
|
* @return {Object}
|
|
6
|
-
*/
|
|
10
|
+
*/
|
|
11
|
+
const reviewsState = (ids = [1], _hash = hash) => ({
|
|
12
|
+
reviewsByHash: {
|
|
13
|
+
[_hash]: {
|
|
14
|
+
isFetching: false,
|
|
15
|
+
expires: 999999999999,
|
|
16
|
+
reviews: ids,
|
|
17
|
+
totalReviewCount: ids.length
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const reviewRouteMock = {
|
|
22
|
+
id: '24284d52-05b3-4da5-b035-6b23dc81b068',
|
|
23
|
+
params: {
|
|
24
|
+
productId: '666f6f'
|
|
25
|
+
},
|
|
26
|
+
pathname: '/item/666f6f/reviews',
|
|
27
|
+
pattern: '/item/:productId/reviews',
|
|
28
|
+
query: {},
|
|
29
|
+
state: {}
|
|
30
|
+
};
|
|
31
|
+
const writeReviewRouteMock = {
|
|
32
|
+
id: '24284d52-05b3-4da5-b035-6b23dc81b068',
|
|
33
|
+
params: {
|
|
34
|
+
productId: '666f6f'
|
|
35
|
+
},
|
|
36
|
+
pathname: '/item/666f6f/write_review',
|
|
37
|
+
pattern: '/item/:productId/write_review',
|
|
38
|
+
query: {},
|
|
39
|
+
state: {}
|
|
40
|
+
};
|
|
41
|
+
const mockedProduct = {
|
|
42
|
+
id: mockProductId,
|
|
43
|
+
baseProductId: null,
|
|
44
|
+
rating: {
|
|
45
|
+
average: 0,
|
|
46
|
+
count: 0
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const mockedProductWithRating = {
|
|
50
|
+
id: mockProductId,
|
|
51
|
+
rating: {
|
|
52
|
+
average: 50,
|
|
53
|
+
count: 4
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
7
58
|
* Creates mocked review object.
|
|
8
59
|
* @param {string|number} id Anything that can be an id.
|
|
9
60
|
* @return {Object}
|
|
10
|
-
*/
|
|
61
|
+
*/
|
|
62
|
+
const mockReview = id => ({
|
|
63
|
+
id,
|
|
64
|
+
author: '',
|
|
65
|
+
date: '2017-09-06T12:38:51.000Z',
|
|
66
|
+
rate: 100,
|
|
67
|
+
title: '',
|
|
68
|
+
review: 'No Name and Title Lorem ipsum dolor sit amet, con… takimata sanctus est Lorem ipsum dolor sit amet.'
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
11
72
|
* Mocked state with 4 reviews.
|
|
12
73
|
* @type {Object}
|
|
13
|
-
*/
|
|
74
|
+
*/
|
|
75
|
+
const mockedStateWithAll = {
|
|
76
|
+
product: {
|
|
77
|
+
productsById: {
|
|
78
|
+
[mockProductId]: {
|
|
79
|
+
productData: mockedProductWithRating
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
variantsByProductId: {}
|
|
83
|
+
},
|
|
84
|
+
reviews: {
|
|
85
|
+
reviewsById: {
|
|
86
|
+
1: mockReview(1),
|
|
87
|
+
2: mockReview(2),
|
|
88
|
+
3: mockReview(3),
|
|
89
|
+
4: mockReview(4)
|
|
90
|
+
},
|
|
91
|
+
reviewsByProductId: {
|
|
92
|
+
[mockProductId]: {
|
|
93
|
+
reviews: [1, 2, 3, 4],
|
|
94
|
+
totalReviewCount: 4
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
...reviewsState([1, 2, 3, 4])
|
|
98
|
+
},
|
|
99
|
+
ui: {
|
|
100
|
+
general: {}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
14
104
|
* Similar to mockedStateWithAll, but contains only two reviews.
|
|
15
105
|
* @type {Object}
|
|
16
|
-
*/
|
|
17
|
-
|
|
106
|
+
*/
|
|
107
|
+
const mockedStateWithTwoReviews = (() => {
|
|
108
|
+
// Must do deep clone here.
|
|
109
|
+
const mockedState = JSON.parse(JSON.stringify(mockedStateWithAll));
|
|
110
|
+
mockedState.reviews.reviewsByProductId[mockProductId].reviews = mockedState.reviews.reviewsByProductId[mockProductId].reviews.slice(0, 2);
|
|
111
|
+
mockedState.reviews.reviewsByProductId[mockProductId].totalReviewCount = 2;
|
|
112
|
+
mockedState.reviews.reviewsByHash[hash].reviews.slice(0, 2);
|
|
113
|
+
mockedState.reviews.reviewsByHash[hash].reviews.totalReviewCount = 2;
|
|
114
|
+
return mockedState;
|
|
115
|
+
})();
|
|
116
|
+
|
|
117
|
+
/**
|
|
18
118
|
* Mocked state with product only. Reviews not fetched.
|
|
19
119
|
* @type {Object}
|
|
20
|
-
*/
|
|
120
|
+
*/
|
|
121
|
+
const mockedStateWithoutReview = {
|
|
122
|
+
product: {
|
|
123
|
+
productsById: {
|
|
124
|
+
[mockProductId]: {
|
|
125
|
+
productData: mockedProduct
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
reviews: {
|
|
130
|
+
reviewsById: {},
|
|
131
|
+
reviewsByProductId: {},
|
|
132
|
+
reviewsByHash: {},
|
|
133
|
+
userReviewsByProductId: {}
|
|
134
|
+
},
|
|
135
|
+
ui: {
|
|
136
|
+
general: {}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
21
140
|
* Mocked state without data.
|
|
22
141
|
* @type {{product: {productsById: {}}}}
|
|
23
|
-
*/
|
|
142
|
+
*/
|
|
143
|
+
const mockedStateProductEmpty = {
|
|
144
|
+
product: {
|
|
145
|
+
productsById: {}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
24
150
|
* @param {string} id The productID.
|
|
25
151
|
* @return {Object}
|
|
26
|
-
*/
|
|
152
|
+
*/
|
|
153
|
+
const getReviewsStateForId = id => {
|
|
154
|
+
const filterHash = `{"filters":{},"pipeline":"shopgate.catalog.getProductReviews","productId":"${id}"}`;
|
|
155
|
+
return {
|
|
156
|
+
reviews: {
|
|
157
|
+
reviewsById: {
|
|
158
|
+
1: mockReview(1),
|
|
159
|
+
2: mockReview(2),
|
|
160
|
+
3: mockReview(3),
|
|
161
|
+
4: mockReview(4)
|
|
162
|
+
},
|
|
163
|
+
reviewsByProductId: {
|
|
164
|
+
[id]: {
|
|
165
|
+
reviews: [1, 2, 3, 4],
|
|
166
|
+
totalReviewCount: 4
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
...reviewsState([1, 2, 3, 4], filterHash)
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
27
175
|
* Sets up mocks.
|
|
28
|
-
* @param {
|
|
176
|
+
* @param {boolean} mockReviewsAvailable A feature flag "hasReviews" value.
|
|
29
177
|
* @type {Function}
|
|
30
|
-
*/
|
|
178
|
+
*/
|
|
179
|
+
const setMocks = (mockReviewsAvailable = true) => {
|
|
180
|
+
jest.doMock('@shopgate/pwa-common/helpers/config', () => ({
|
|
181
|
+
...jest.requireActual('@shopgate/pwa-common/helpers/config'),
|
|
182
|
+
get hasReviews() {
|
|
183
|
+
return mockReviewsAvailable;
|
|
184
|
+
},
|
|
185
|
+
get showWriteReview() {
|
|
186
|
+
return true;
|
|
187
|
+
},
|
|
188
|
+
themeConfig: mockedConfig
|
|
189
|
+
}));
|
|
190
|
+
};
|
|
191
|
+
export { hash, mockProductId, getReviewsStateForId, mockReview, mockedStateProductEmpty, mockedStateWithoutReview, mockedStateWithTwoReviews, mockedStateWithAll, reviewRouteMock, writeReviewRouteMock, setMocks };
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import{combineReducers}from'redux';
|
|
1
|
+
import { combineReducers } from 'redux';
|
|
2
|
+
import reviewsByHash from "./reviewsByHash";
|
|
3
|
+
import reviewsById from "./reviewsById";
|
|
4
|
+
import reviewsByProductId from "./reviewsByProductId";
|
|
5
|
+
import userReviewsByProductId from "./userReviewsByProductId";
|
|
6
|
+
export default combineReducers({
|
|
7
|
+
reviewsByHash,
|
|
8
|
+
reviewsById,
|
|
9
|
+
reviewsByProductId,
|
|
10
|
+
userReviewsByProductId
|
|
11
|
+
});
|
package/reviews/reducers/mock.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { testReviews } from "../selectors/mock";
|
|
2
|
+
const reviews = testReviews.slice();
|
|
3
|
+
let currentId = reviews.length;
|
|
4
|
+
// Copy of reviews with different ids.
|
|
5
|
+
const moreReviews = reviews.map(review => {
|
|
6
|
+
currentId += 1;
|
|
7
|
+
return {
|
|
8
|
+
...review,
|
|
9
|
+
id: currentId
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
export const mockedReviews = reviews;
|
|
13
|
+
export const moreMockedReviews = moreReviews;
|
|
14
|
+
export const totalReviewCount = reviews.length + moreReviews.length;
|
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
import uniq from 'lodash/uniq';
|
|
2
|
+
import { REVIEWS_LIFETIME, REQUEST_REVIEWS, RECEIVE_REVIEWS, ERROR_REVIEWS } from "../constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
2
5
|
* Stores a collection of products by the related hash of the request parameters.
|
|
3
6
|
* @param {Object} [state={}] The current state.
|
|
4
7
|
* @param {Object} action The current redux action.
|
|
5
8
|
* @return {Object} The new state.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
*/
|
|
10
|
+
function reviewsByHash(state = {}, action) {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case REQUEST_REVIEWS:
|
|
13
|
+
return {
|
|
14
|
+
...state,
|
|
15
|
+
[action.hash]: {
|
|
16
|
+
...state[action.hash],
|
|
17
|
+
isFetching: true,
|
|
18
|
+
expires: 0
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
case RECEIVE_REVIEWS:
|
|
22
|
+
{
|
|
23
|
+
const reviews = state[action.hash].reviews || [];
|
|
24
|
+
const nextReviews = action.reviews || [];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* If there are no previous reviews and no incoming reviews
|
|
28
|
+
* its set to empty array, otherwise it will be an array of the previous and the
|
|
29
|
+
* new reviews. Duplicates are removed.
|
|
30
|
+
*/
|
|
31
|
+
const stateReviews = reviews || nextReviews.length ? uniq([...reviews, ...nextReviews.map(review => review.id)]) : [];
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
[action.hash]: {
|
|
35
|
+
...state[action.hash],
|
|
36
|
+
reviews: stateReviews,
|
|
37
|
+
totalReviewCount: action.totalReviewCount || null,
|
|
38
|
+
isFetching: false,
|
|
39
|
+
expires: Date.now() + REVIEWS_LIFETIME
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
case ERROR_REVIEWS:
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
[action.hash]: {
|
|
47
|
+
...state[action.hash],
|
|
48
|
+
isFetching: false,
|
|
49
|
+
expires: 0
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export default reviewsByHash;
|
|
@@ -1,6 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import "core-js/modules/es.array.reduce.js";
|
|
2
|
+
import { RECEIVE_PRODUCT_REVIEWS, RECEIVE_REVIEWS, RECEIVE_USER_REVIEW, RECEIVE_SUBMIT_REVIEW } from "../constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
2
5
|
* Stores a collection of products by the related hash of the request parameters.
|
|
3
6
|
* @param {Object} [state={}] The current state.
|
|
4
7
|
* @param {Object} action The current redux action.
|
|
5
8
|
* @return {Object} The new state.
|
|
6
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
function reviewsById(state = {}, action) {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case RECEIVE_PRODUCT_REVIEWS:
|
|
13
|
+
case RECEIVE_REVIEWS:
|
|
14
|
+
{
|
|
15
|
+
const nextReviews = action.reviews || [];
|
|
16
|
+
return nextReviews.reduce((currentReviews, review) => ({
|
|
17
|
+
...currentReviews,
|
|
18
|
+
[review.id]: review
|
|
19
|
+
}), state);
|
|
20
|
+
}
|
|
21
|
+
case RECEIVE_SUBMIT_REVIEW:
|
|
22
|
+
case RECEIVE_USER_REVIEW:
|
|
23
|
+
return {
|
|
24
|
+
...state,
|
|
25
|
+
[action.review.id]: action.review
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
return state;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default reviewsById;
|
|
@@ -1,6 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
import { REQUEST_PRODUCT_REVIEWS, RECEIVE_PRODUCT_REVIEWS, ERROR_PRODUCT_REVIEWS, REQUEST_SUBMIT_REVIEW, REVIEWS_LIFETIME } from "../constants";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Stores product reviews by their product ID.
|
|
3
5
|
* @param {Object} [state={}] The current state.
|
|
4
6
|
* @param {Object} action The action object.
|
|
5
7
|
* @return {Object} The new state.
|
|
6
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
export default function reviewsByProductId(state = {}, action) {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case REQUEST_PRODUCT_REVIEWS:
|
|
12
|
+
return {
|
|
13
|
+
...state,
|
|
14
|
+
[action.productId]: {
|
|
15
|
+
...state[action.productId],
|
|
16
|
+
isFetching: true,
|
|
17
|
+
expires: 0
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
case RECEIVE_PRODUCT_REVIEWS:
|
|
21
|
+
return {
|
|
22
|
+
...state,
|
|
23
|
+
[action.productId]: {
|
|
24
|
+
...state[action.productId],
|
|
25
|
+
isFetching: false,
|
|
26
|
+
reviews: action.reviews.map(review => review.id),
|
|
27
|
+
totalReviewCount: action.totalReviewCount,
|
|
28
|
+
expires: Date.now() + REVIEWS_LIFETIME
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
case ERROR_PRODUCT_REVIEWS:
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
[action.productId]: {
|
|
35
|
+
...state[action.productId],
|
|
36
|
+
isFetching: false,
|
|
37
|
+
expires: 0
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
case REQUEST_SUBMIT_REVIEW:
|
|
41
|
+
return {
|
|
42
|
+
...state,
|
|
43
|
+
[action.review.productId]: {
|
|
44
|
+
...(state[action.review.productId] || {}),
|
|
45
|
+
expires: 0
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
default:
|
|
49
|
+
return state;
|
|
50
|
+
}
|
|
51
|
+
}
|
package/reviews/reducers/spec.js
CHANGED
|
@@ -1,5 +1,214 @@
|
|
|
1
|
-
|
|
1
|
+
import { RECEIVE_REVIEWS, REQUEST_REVIEWS, ERROR_REVIEWS, REQUEST_PRODUCT_REVIEWS, RECEIVE_PRODUCT_REVIEWS, ERROR_PRODUCT_REVIEWS, REQUEST_USER_REVIEW, RECEIVE_USER_REVIEW, ERROR_USER_REVIEW, REQUEST_SUBMIT_REVIEW, RECEIVE_SUBMIT_REVIEW, ERROR_SUBMIT_REVIEW, RESET_SUBMIT_REVIEW } from "../constants";
|
|
2
|
+
import { mockedReviews, moreMockedReviews, totalReviewCount } from "./mock";
|
|
3
|
+
import reducers from "./index";
|
|
4
|
+
describe('Reviews reducers', () => {
|
|
5
|
+
describe('ReviewsByHash', () => {
|
|
6
|
+
const hash = 'foo';
|
|
7
|
+
let state = {};
|
|
8
|
+
|
|
9
|
+
/**
|
|
2
10
|
* Helper function for comparing changed state against expected shape.
|
|
3
11
|
* @param {Object} receivedState State.
|
|
4
12
|
* @param {number} expectedReviewsLength How many reviews should be stored.
|
|
5
|
-
*/
|
|
13
|
+
*/
|
|
14
|
+
const analyzeReceivedState = (receivedState, expectedReviewsLength = totalReviewCount) => {
|
|
15
|
+
expect(receivedState.reviewsByHash[hash].totalReviewCount).toBe(totalReviewCount);
|
|
16
|
+
expect(receivedState.reviewsByHash[hash].reviews).toBeInstanceOf(Array);
|
|
17
|
+
expect(receivedState.reviewsByHash[hash].reviews).toBeInstanceOf(Array);
|
|
18
|
+
expect(receivedState.reviewsByHash[hash].reviews).toHaveLength(expectedReviewsLength);
|
|
19
|
+
};
|
|
20
|
+
describe(REQUEST_REVIEWS, () => {
|
|
21
|
+
it('should manipulate state when REQUEST_REVIEWS', () => {
|
|
22
|
+
state = reducers(state, {
|
|
23
|
+
type: REQUEST_REVIEWS,
|
|
24
|
+
hash
|
|
25
|
+
});
|
|
26
|
+
expect(state.reviewsByHash[hash]).toEqual({
|
|
27
|
+
expires: 0,
|
|
28
|
+
isFetching: true
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe(RECEIVE_REVIEWS, () => {
|
|
33
|
+
it('should manipulate state when receive reviews', () => {
|
|
34
|
+
state = reducers(state, {
|
|
35
|
+
type: RECEIVE_REVIEWS,
|
|
36
|
+
hash,
|
|
37
|
+
reviews: mockedReviews,
|
|
38
|
+
totalReviewCount
|
|
39
|
+
});
|
|
40
|
+
analyzeReceivedState(state, mockedReviews.length);
|
|
41
|
+
expect(state.reviewsByHash[hash].expires).toBeGreaterThan(Date.now());
|
|
42
|
+
});
|
|
43
|
+
it('should append more reviews when received more', () => {
|
|
44
|
+
state = reducers(state, {
|
|
45
|
+
type: RECEIVE_REVIEWS,
|
|
46
|
+
hash,
|
|
47
|
+
reviews: moreMockedReviews,
|
|
48
|
+
totalReviewCount
|
|
49
|
+
});
|
|
50
|
+
analyzeReceivedState(state);
|
|
51
|
+
expect(state.reviewsByHash[hash].expires).toBeGreaterThan(Date.now());
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe(ERROR_REVIEWS, () => {
|
|
55
|
+
it('should handle error state', () => {
|
|
56
|
+
state.reviewsByHash[hash].isFetching = true;
|
|
57
|
+
state = reducers(state, {
|
|
58
|
+
type: ERROR_REVIEWS,
|
|
59
|
+
hash
|
|
60
|
+
});
|
|
61
|
+
analyzeReceivedState(state);
|
|
62
|
+
expect(state.reviewsByHash[hash].expires).toBe(0);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('ReviewsByProductId', () => {
|
|
67
|
+
let state = {};
|
|
68
|
+
describe(REQUEST_PRODUCT_REVIEWS, () => {
|
|
69
|
+
it('should manipulate state when REQUEST_REVIEWS', () => {
|
|
70
|
+
state = reducers(state, {
|
|
71
|
+
type: REQUEST_PRODUCT_REVIEWS,
|
|
72
|
+
productId: 'foo'
|
|
73
|
+
});
|
|
74
|
+
expect(state.reviewsByProductId.foo).toEqual({
|
|
75
|
+
expires: 0,
|
|
76
|
+
isFetching: true
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe(RECEIVE_PRODUCT_REVIEWS, () => {
|
|
81
|
+
it('should manipulate state when receive reviews', () => {
|
|
82
|
+
state = reducers(state, {
|
|
83
|
+
type: RECEIVE_PRODUCT_REVIEWS,
|
|
84
|
+
productId: 'foo',
|
|
85
|
+
reviews: mockedReviews,
|
|
86
|
+
totalReviewCount
|
|
87
|
+
});
|
|
88
|
+
expect(state.reviewsByProductId.foo.reviews.length).toBe(mockedReviews.length);
|
|
89
|
+
});
|
|
90
|
+
it('should replace reviews on another call when received more', () => {
|
|
91
|
+
state = reducers(state, {
|
|
92
|
+
type: RECEIVE_PRODUCT_REVIEWS,
|
|
93
|
+
productId: 'foo',
|
|
94
|
+
reviews: moreMockedReviews,
|
|
95
|
+
totalReviewCount
|
|
96
|
+
});
|
|
97
|
+
expect(state.reviewsByProductId.foo.reviews.length).toBe(moreMockedReviews.length);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe(ERROR_PRODUCT_REVIEWS, () => {
|
|
101
|
+
it('should handle error state', () => {
|
|
102
|
+
state.reviewsByProductId.foo.isFetching = true;
|
|
103
|
+
state = reducers(state, {
|
|
104
|
+
type: ERROR_PRODUCT_REVIEWS,
|
|
105
|
+
productId: 'foo'
|
|
106
|
+
});
|
|
107
|
+
expect(state.reviewsByProductId.foo.isFetching).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('userReviewsByProductId', () => {
|
|
112
|
+
let state = {};
|
|
113
|
+
const review = {
|
|
114
|
+
id: 'id',
|
|
115
|
+
one: 1,
|
|
116
|
+
two: {}
|
|
117
|
+
};
|
|
118
|
+
const reviewWithProductId = {
|
|
119
|
+
...review,
|
|
120
|
+
productId: 'foo'
|
|
121
|
+
};
|
|
122
|
+
describe(REQUEST_USER_REVIEW, () => {
|
|
123
|
+
it('should handle request state', () => {
|
|
124
|
+
state = reducers(state, {
|
|
125
|
+
type: REQUEST_USER_REVIEW,
|
|
126
|
+
productId: 'foo'
|
|
127
|
+
});
|
|
128
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(true);
|
|
129
|
+
expect(state.userReviewsByProductId.foo.review).toEqual('');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe(RECEIVE_USER_REVIEW, () => {
|
|
133
|
+
it('should handle receive state', () => {
|
|
134
|
+
state = reducers(state, {
|
|
135
|
+
type: RECEIVE_USER_REVIEW,
|
|
136
|
+
productId: 'foo',
|
|
137
|
+
review
|
|
138
|
+
});
|
|
139
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(false);
|
|
140
|
+
expect(state.userReviewsByProductId.foo.review).toEqual('id');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe(ERROR_USER_REVIEW, () => {
|
|
144
|
+
it('should handle receive state', () => {
|
|
145
|
+
state = reducers(state, {
|
|
146
|
+
type: ERROR_USER_REVIEW,
|
|
147
|
+
productId: 'foo'
|
|
148
|
+
});
|
|
149
|
+
expect(typeof state.userReviewsByProductId.foo).toBe('undefined');
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe(RECEIVE_USER_REVIEW, () => {
|
|
153
|
+
it('should handle receive state', () => {
|
|
154
|
+
state = reducers(state, {
|
|
155
|
+
type: RECEIVE_USER_REVIEW,
|
|
156
|
+
productId: 'foo',
|
|
157
|
+
review: reviewWithProductId
|
|
158
|
+
});
|
|
159
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(false);
|
|
160
|
+
expect(state.userReviewsByProductId.foo.review).toEqual('id');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
describe(REQUEST_SUBMIT_REVIEW, () => {
|
|
164
|
+
it('should handle request state', () => {
|
|
165
|
+
state = reducers(state, {
|
|
166
|
+
type: REQUEST_SUBMIT_REVIEW,
|
|
167
|
+
review: {
|
|
168
|
+
...review,
|
|
169
|
+
productId: 'foo'
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(true);
|
|
173
|
+
expect(state.userReviewsByProductId.foo.review).toEqual('id');
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe(RECEIVE_SUBMIT_REVIEW, () => {
|
|
177
|
+
it('should handle receive state', () => {
|
|
178
|
+
reviewWithProductId.one = 'one';
|
|
179
|
+
state = reducers(state, {
|
|
180
|
+
type: RECEIVE_SUBMIT_REVIEW,
|
|
181
|
+
review: reviewWithProductId
|
|
182
|
+
});
|
|
183
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(false);
|
|
184
|
+
expect(state.userReviewsByProductId.foo.review).toEqual('id');
|
|
185
|
+
expect(state.reviewsById[reviewWithProductId.id]).toEqual(reviewWithProductId);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe(ERROR_SUBMIT_REVIEW, () => {
|
|
189
|
+
it('should handle receive state', () => {
|
|
190
|
+
state = reducers(state, {
|
|
191
|
+
type: ERROR_SUBMIT_REVIEW,
|
|
192
|
+
productId: 'foo'
|
|
193
|
+
});
|
|
194
|
+
expect(typeof state.userReviewsByProductId.foo).toBe('undefined');
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
describe(RESET_SUBMIT_REVIEW, () => {
|
|
198
|
+
it('should handle receive state', () => {
|
|
199
|
+
state = reducers(state, {
|
|
200
|
+
type: RESET_SUBMIT_REVIEW,
|
|
201
|
+
productId: 'foo',
|
|
202
|
+
review: {
|
|
203
|
+
productId: 'foo',
|
|
204
|
+
one: '1'
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
expect(state.userReviewsByProductId.foo.isFetching).toBe(false);
|
|
208
|
+
expect(state.userReviewsByProductId.foo).toEqual({
|
|
209
|
+
isFetching: false
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|