Skip to content

Commit 90226ae

Browse files
committed
Moved mock data, removed un-needed index
1 parent 2600c99 commit 90226ae

File tree

3 files changed

+53
-54
lines changed

3 files changed

+53
-54
lines changed

packages/template-retail-react-app/app/mocks/mock-data.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5711,3 +5711,52 @@ export const mockPasswordUpdateFalure = {
57115711
detail: 'The update password request is invalid. Customer\u0027s current password is not valid',
57125712
errorMessage: 'Customer\u0027s current password is not valid'
57135713
}
5714+
5715+
export const mockBonusProductBasket = {
5716+
baskets: [
5717+
{
5718+
...mockCustomerBaskets.baskets[0],
5719+
productItems: [
5720+
{
5721+
adjustedTax: 2.93,
5722+
basePrice: 61.43,
5723+
bonusProductLineItem: false,
5724+
gift: false,
5725+
itemId: '4a9af0a24fe46c3f6d8721b371',
5726+
itemText: 'Belted Cardigan With Studs',
5727+
price: 61.43,
5728+
priceAfterItemDiscount: 61.43,
5729+
priceAfterOrderDiscount: 61.43,
5730+
productId: '701642889830M',
5731+
productName: 'Belted Cardigan With Studs',
5732+
quantity: 2,
5733+
shipmentId: 'me',
5734+
tax: 2.93,
5735+
taxBasis: 61.43,
5736+
taxClassId: 'standard',
5737+
taxRate: 0.05
5738+
},
5739+
{
5740+
adjustedTax: 0,
5741+
basePrice: 0,
5742+
bonusProductLineItem: true,
5743+
gift: false,
5744+
itemId: '5b1a03848f0807f99f37ea93e4',
5745+
itemText: 'Free Gift with Purchase',
5746+
price: 0,
5747+
priceAfterItemDiscount: 0,
5748+
priceAfterOrderDiscount: 0,
5749+
productId: '013742335262M',
5750+
productName: 'Free Gift with Purchase',
5751+
quantity: 1,
5752+
shipmentId: 'me',
5753+
tax: 0,
5754+
taxBasis: 0,
5755+
taxClassId: 'standard',
5756+
taxRate: 0.05
5757+
}
5758+
]
5759+
}
5760+
],
5761+
total: 1
5762+
}

packages/template-retail-react-app/app/pages/cart/index.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,9 @@ const Cart = () => {
557557
<GridItem>
558558
<Stack spacing={4}>
559559
{/* Regular Products */}
560-
{categorizedProducts.regularProducts.map((productItem, idx) => (
560+
{categorizedProducts.regularProducts.map((productItem) => (
561561
<ProductItem
562562
key={productItem.itemId}
563-
index={idx}
564563
secondaryActions={
565564
<CartSecondaryButtonGroup
566565
isAGift={
@@ -608,10 +607,9 @@ const Cart = () => {
608607
<BonusProductsTitle />
609608
</Box>
610609
{categorizedProducts.bonusProducts.map(
611-
(productItem, idx) => (
610+
(productItem) => (
612611
<ProductItem
613612
key={productItem.itemId}
614-
index={idx}
615613
secondaryActions={
616614
<CartSecondaryButtonGroup
617615
isAGift={

packages/template-retail-react-app/app/pages/cart/index.test.js

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
mockCustomerBaskets,
1515
mockEmptyBasket,
1616
mockCartVariant,
17-
mockedCustomerProductLists
17+
mockedCustomerProductLists,
18+
mockBonusProductBasket
1819
} from '@salesforce/retail-react-app/app/mocks/mock-data'
1920
import mockVariant from '@salesforce/retail-react-app/app/mocks/variant-750518699578M'
2021
import {rest} from 'msw'
@@ -68,55 +69,6 @@ const mockProductBundleBasket = {
6869
total: 1
6970
}
7071

71-
const mockBonusProductBasket = {
72-
baskets: [
73-
{
74-
...mockCustomerBaskets.baskets[0],
75-
productItems: [
76-
{
77-
adjustedTax: 2.93,
78-
basePrice: 61.43,
79-
bonusProductLineItem: false,
80-
gift: false,
81-
itemId: '4a9af0a24fe46c3f6d8721b371',
82-
itemText: 'Belted Cardigan With Studs',
83-
price: 61.43,
84-
priceAfterItemDiscount: 61.43,
85-
priceAfterOrderDiscount: 61.43,
86-
productId: '701642889830M',
87-
productName: 'Belted Cardigan With Studs',
88-
quantity: 2,
89-
shipmentId: 'me',
90-
tax: 2.93,
91-
taxBasis: 61.43,
92-
taxClassId: 'standard',
93-
taxRate: 0.05
94-
},
95-
{
96-
adjustedTax: 0,
97-
basePrice: 0,
98-
bonusProductLineItem: true,
99-
gift: false,
100-
itemId: '5b1a03848f0807f99f37ea93e4',
101-
itemText: 'Free Gift with Purchase',
102-
price: 0,
103-
priceAfterItemDiscount: 0,
104-
priceAfterOrderDiscount: 0,
105-
productId: '013742335262M',
106-
productName: 'Free Gift with Purchase',
107-
quantity: 1,
108-
shipmentId: 'me',
109-
tax: 0,
110-
taxBasis: 0,
111-
taxClassId: 'standard',
112-
taxRate: 0.05
113-
}
114-
]
115-
}
116-
],
117-
total: 1
118-
}
119-
12072
// Set up and clean up
12173
beforeEach(() => {
12274
global.server.use(

0 commit comments

Comments
 (0)