@salesforce/retail-react-app 7.1.0-preview.0 → 8.0.0-dev

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +8 -4
  2. package/app/components/_app/index.jsx +9 -7
  3. package/app/components/_app/index.test.js +2 -2
  4. package/app/components/_app-config/index.jsx +9 -3
  5. package/app/components/drawer-menu/drawer-menu.jsx +3 -1
  6. package/app/components/footer/index.jsx +3 -1
  7. package/app/components/header/index.jsx +3 -1
  8. package/app/components/header/index.test.js +2 -2
  9. package/app/components/island/README.md +1 -1
  10. package/app/components/island/index.jsx +3 -1
  11. package/app/components/island/index.test.js +94 -5
  12. package/app/components/item-variant/item-attributes.jsx +12 -3
  13. package/app/components/multiship/multiship-order-summary.jsx +137 -0
  14. package/app/components/multiship/multiship-order-summary.test.js +121 -0
  15. package/app/components/order-summary/index.jsx +2 -4
  16. package/app/components/pickup-or-delivery/index.jsx +80 -0
  17. package/app/components/pickup-or-delivery/index.test.jsx +182 -0
  18. package/app/components/product-item/index.jsx +26 -16
  19. package/app/components/product-item/index.test.js +29 -2
  20. package/app/components/product-item-list/index.jsx +10 -0
  21. package/app/components/product-item-list/index.test.jsx +14 -0
  22. package/app/components/product-view/index.jsx +9 -6
  23. package/app/components/product-view/index.test.js +25 -21
  24. package/app/components/quantity-picker/index.test.jsx +12 -12
  25. package/app/components/reset-password/index.test.js +1 -1
  26. package/app/components/shared/ui/AlertDescription/index.jsx +8 -0
  27. package/app/components/shared/ui/index.jsx +1 -0
  28. package/app/components/store-display/index.jsx +28 -4
  29. package/app/components/store-display/index.test.js +71 -0
  30. package/app/components/store-locator/form.test.jsx +16 -4
  31. package/app/components/store-locator/list.jsx +9 -4
  32. package/app/components/toggle-card/index.jsx +14 -0
  33. package/app/components/unavailable-product-confirmation-modal/index.jsx +19 -5
  34. package/app/components/unavailable-product-confirmation-modal/index.test.js +122 -1
  35. package/app/constants.js +20 -6
  36. package/app/contexts/store-locator-provider.jsx +7 -1
  37. package/app/contexts/store-locator-provider.test.jsx +36 -1
  38. package/app/hooks/use-address-form.js +155 -0
  39. package/app/hooks/use-address-form.test.js +501 -0
  40. package/app/hooks/use-auth-modal.js +2 -6
  41. package/app/hooks/use-current-basket.js +71 -2
  42. package/app/hooks/use-current-basket.test.js +37 -1
  43. package/app/hooks/use-dnt-notification.js +4 -4
  44. package/app/hooks/use-dnt-notification.test.js +5 -5
  45. package/app/hooks/use-item-shipment-management.js +233 -0
  46. package/app/hooks/use-item-shipment-management.test.js +696 -0
  47. package/app/hooks/use-multiship.js +589 -0
  48. package/app/hooks/use-multiship.test.js +776 -0
  49. package/app/hooks/use-pickup-shipment.js +70 -106
  50. package/app/hooks/use-pickup-shipment.test.js +345 -209
  51. package/app/hooks/use-product-address-assignment.js +280 -0
  52. package/app/hooks/use-product-address-assignment.test.js +414 -0
  53. package/app/hooks/use-product-inventory.js +100 -0
  54. package/app/hooks/use-product-inventory.test.js +254 -0
  55. package/app/hooks/use-shipment-operations.js +168 -0
  56. package/app/hooks/use-shipment-operations.test.js +385 -0
  57. package/app/hooks/use-store-locator.js +24 -2
  58. package/app/hooks/use-store-locator.test.jsx +109 -1
  59. package/app/pages/account/index.test.js +1 -1
  60. package/app/pages/account/profile.test.js +0 -2
  61. package/app/pages/cart/index.jsx +397 -157
  62. package/app/pages/cart/index.test.js +353 -2
  63. package/app/pages/cart/partials/bonus-products-title.jsx +10 -8
  64. package/app/pages/cart/partials/cart-secondary-button-group.test.js +1 -1
  65. package/app/pages/cart/partials/order-type-display.jsx +68 -0
  66. package/app/pages/cart/partials/order-type-display.test.js +241 -0
  67. package/app/pages/checkout/confirmation.jsx +79 -158
  68. package/app/pages/checkout/index.jsx +34 -9
  69. package/app/pages/checkout/index.test.js +245 -118
  70. package/app/pages/checkout/partials/contact-info.jsx +2 -6
  71. package/app/pages/checkout/partials/contact-info.test.js +93 -7
  72. package/app/pages/checkout/partials/payment.jsx +19 -5
  73. package/app/pages/checkout/partials/pickup-address.jsx +340 -70
  74. package/app/pages/checkout/partials/pickup-address.test.js +1075 -82
  75. package/app/pages/checkout/partials/product-shipping-address-card.jsx +382 -0
  76. package/app/pages/checkout/partials/shipment-details.jsx +209 -0
  77. package/app/pages/checkout/partials/shipment-details.test.js +246 -0
  78. package/app/pages/checkout/partials/shipping-address.jsx +156 -68
  79. package/app/pages/checkout/partials/shipping-address.test.js +673 -0
  80. package/app/pages/checkout/partials/shipping-method-options.jsx +180 -0
  81. package/app/pages/checkout/partials/shipping-methods.jsx +403 -0
  82. package/app/pages/checkout/partials/shipping-methods.test.js +472 -0
  83. package/app/pages/checkout/partials/shipping-multi-address.jsx +259 -0
  84. package/app/pages/checkout/partials/shipping-multi-address.test.js +2088 -0
  85. package/app/pages/checkout/partials/shipping-product-cards.jsx +101 -0
  86. package/app/pages/checkout/util/checkout-context.js +25 -18
  87. package/app/pages/login/index.jsx +2 -6
  88. package/app/pages/product-detail/index.jsx +96 -81
  89. package/app/pages/product-detail/index.test.js +103 -19
  90. package/app/pages/product-list/index.jsx +3 -1
  91. package/app/pages/product-list/partials/inventory-filter.jsx +18 -21
  92. package/app/pages/product-list/partials/inventory-filter.test.js +15 -17
  93. package/app/pages/product-list/partials/selected-refinements.jsx +3 -1
  94. package/app/ssr.js +1 -5
  95. package/app/static/translations/compiled/en-GB.json +316 -30
  96. package/app/static/translations/compiled/en-US.json +316 -30
  97. package/app/static/translations/compiled/en-XA.json +673 -75
  98. package/app/utils/address-utils.js +112 -0
  99. package/app/utils/address-utils.test.js +484 -0
  100. package/app/utils/product-utils.js +17 -5
  101. package/app/utils/product-utils.test.js +17 -8
  102. package/app/utils/sfdc-user-agent-utils.js +32 -0
  103. package/app/utils/sfdc-user-agent-utils.test.js +82 -0
  104. package/app/utils/shipment-utils.js +196 -0
  105. package/app/utils/shipment-utils.test.js +458 -0
  106. package/app/utils/test-utils.js +4 -4
  107. package/app/utils/utils.js +6 -1
  108. package/config/default.js +4 -1
  109. package/config/mocks/default.js +3 -1
  110. package/package.json +9 -9
  111. package/translations/en-GB.json +127 -10
  112. package/translations/en-US.json +127 -10
  113. package/app/pages/checkout/partials/shipping-options.jsx +0 -269
@@ -6,24 +6,77 @@
6
6
  */
7
7
  import React from 'react'
8
8
  import {screen, waitFor, cleanup} from '@testing-library/react'
9
+ import {rest} from 'msw'
10
+ import {setupServer} from 'msw/node'
9
11
  import PickupAddress from '@salesforce/retail-react-app/app/pages/checkout/partials/pickup-address'
10
12
  import {renderWithProviders} from '@salesforce/retail-react-app/app/utils/test-utils'
13
+ import {scapiBasketWithItem} from '@salesforce/retail-react-app/app/mocks/mock-data'
14
+ import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket'
15
+ import {useSelectedStore} from '@salesforce/retail-react-app/app/hooks/use-selected-store'
16
+
17
+ // Mock the hooks
18
+ jest.mock('@salesforce/retail-react-app/app/hooks/use-current-basket')
19
+ jest.mock('@salesforce/retail-react-app/app/hooks/use-selected-store')
20
+ jest.mock('@salesforce/retail-react-app/app/hooks/use-multi-site')
21
+
22
+ // Mock ItemAttributes component to avoid variationValues issues
23
+ jest.mock('@salesforce/retail-react-app/app/components/item-variant/item-attributes', () => {
24
+ return function MockItemAttributes() {
25
+ return <div data-testid="item-attributes">Item Attributes</div>
26
+ }
27
+ })
28
+
29
+ // Mock goToNextStep function
30
+ const mockGoToNextStep = jest.fn()
31
+
32
+ // Configurable checkout state for tests
33
+ const mockCheckoutState = {
34
+ step: 1,
35
+ STEPS: {
36
+ CONTACT_INFO: 0,
37
+ PICKUP_ADDRESS: 1,
38
+ SHIPPING_ADDRESS: 2,
39
+ SHIPPING_OPTIONS: 3,
40
+ PAYMENT: 4,
41
+ REVIEW_ORDER: 5
42
+ },
43
+ goToStep: jest.fn(),
44
+ goToNextStep: mockGoToNextStep
45
+ }
46
+
47
+ const mockProductsArray = [
48
+ {
49
+ id: 'product-1',
50
+ name: 'Test Product 1',
51
+ image: 'product-1-image.jpg',
52
+ price: 29.99,
53
+ variationAttributes: [
54
+ {id: 'color', name: 'Color'},
55
+ {id: 'size', name: 'Size'}
56
+ ]
57
+ },
58
+ {
59
+ id: 'product-2',
60
+ name: 'Test Product 2',
61
+ image: 'product-2-image.jpg',
62
+ price: 19.99,
63
+ variationAttributes: [
64
+ {id: 'color', name: 'Color'},
65
+ {id: 'size', name: 'Size'}
66
+ ]
67
+ }
68
+ ]
11
69
 
12
- // Mock useShopperBasketsMutation
13
- const mockMutateAsync = jest.fn()
14
70
  jest.mock('@salesforce/commerce-sdk-react', () => {
15
71
  const originalModule = jest.requireActual('@salesforce/commerce-sdk-react')
16
72
  return {
17
73
  ...originalModule,
18
- useShopperBasketsMutation: () => ({
19
- mutateAsync: mockMutateAsync
20
- }),
21
74
  useStores: () => ({
22
75
  data: {
23
76
  data: [
24
77
  {
25
- id: 'store-123',
26
- name: 'Test Store',
78
+ id: 'store-1',
79
+ name: 'Test Store 1',
27
80
  address1: '123 Main Street',
28
81
  city: 'San Francisco',
29
82
  stateCode: 'CA',
@@ -32,127 +85,1067 @@ jest.mock('@salesforce/commerce-sdk-react', () => {
32
85
  phone: '555-123-4567',
33
86
  storeHours: 'Mon-Fri: 9AM-6PM',
34
87
  storeType: 'retail'
88
+ },
89
+ {
90
+ id: 'store-2',
91
+ name: 'Test Store 2',
92
+ address1: '456 Oak Avenue',
93
+ city: 'Los Angeles',
94
+ stateCode: 'CA',
95
+ postalCode: '90210',
96
+ countryCode: 'US',
97
+ phone: '555-987-6543',
98
+ storeHours: 'Mon-Sat: 10AM-8PM',
99
+ storeType: 'retail'
35
100
  }
36
101
  ]
37
102
  },
38
- isLoading: false,
39
- error: null
103
+ isLoading: false
104
+ }),
105
+ useProducts: () => ({
106
+ data: mockProductsArray,
107
+ isLoading: false
40
108
  })
41
109
  }
42
110
  })
43
111
 
44
112
  // Ensure useMultiSite returns site.id = 'site-1' for all tests
45
- jest.mock('@salesforce/retail-react-app/app/hooks/use-multi-site', () => ({
46
- __esModule: true,
47
- default: () => ({
48
- site: {id: 'site-1'}
49
- })
113
+ jest.mock('@salesforce/retail-react-app/app/hooks/use-multi-site', () =>
114
+ jest.fn(() => ({
115
+ site: {id: 'site-1'},
116
+ buildUrl: jest.fn((url) => url)
117
+ }))
118
+ )
119
+
120
+ jest.mock('@salesforce/retail-react-app/app/pages/checkout/util/checkout-context', () => ({
121
+ useCheckout: () => mockCheckoutState
50
122
  }))
51
123
 
52
- jest.mock('@salesforce/retail-react-app/app/hooks/use-current-basket', () => ({
53
- useCurrentBasket: () => ({
54
- data: {
55
- basketId: 'e4547d1b21d01bf5ad92d30c9d',
56
- currency: 'GBP',
57
- customerInfo: {
58
- customerId: 'ablXcZlbAXmewRledJmqYYlKk0'
59
- },
60
- orderTotal: 25.17,
61
- productItems: [
124
+ const server = setupServer()
125
+
126
+ // Build derivedData consistent with useCurrentBasket
127
+ const buildDerivedData = (basket) => {
128
+ const productItems = basket?.productItems || []
129
+ const shipments = basket?.shipments || []
130
+ let totalItems = 0
131
+ const shipmentIdToTotalItems = {}
132
+ productItems.forEach((item) => {
133
+ const quantity = item?.quantity || 0
134
+ totalItems += quantity
135
+ if (item?.shipmentId) {
136
+ shipmentIdToTotalItems[item.shipmentId] =
137
+ (shipmentIdToTotalItems[item.shipmentId] || 0) + quantity
138
+ }
139
+ })
140
+ let totalDeliveryShipments = 0
141
+ let totalPickupShipments = 0
142
+ const pickupStoreIds = []
143
+ let isMissingShippingAddress = false
144
+ let isMissingShippingMethod = false
145
+ shipments.forEach((shipment) => {
146
+ const hasItems = shipmentIdToTotalItems[shipment?.shipmentId] > 0
147
+ if (!hasItems) return
148
+ const isPickup = Boolean(shipment?.shippingMethod?.c_storePickupEnabled)
149
+ if (isPickup) {
150
+ totalPickupShipments += 1
151
+ if (shipment?.c_fromStoreId) pickupStoreIds.push(shipment.c_fromStoreId)
152
+ } else {
153
+ totalDeliveryShipments += 1
154
+ if (!shipment?.shippingAddress) isMissingShippingAddress = true
155
+ if (!shipment?.shippingMethod) isMissingShippingMethod = true
156
+ }
157
+ })
158
+ pickupStoreIds.sort()
159
+ return {
160
+ hasBasket: productItems.length > 0 || shipments.length > 0,
161
+ totalItems,
162
+ shipmentIdToTotalItems,
163
+ totalDeliveryShipments,
164
+ totalPickupShipments,
165
+ pickupStoreIds,
166
+ isMissingShippingAddress,
167
+ isMissingShippingMethod
168
+ }
169
+ }
170
+
171
+ beforeAll(() => {
172
+ server.listen()
173
+ })
174
+
175
+ afterEach(() => {
176
+ server.resetHandlers()
177
+ cleanup()
178
+ jest.clearAllMocks()
179
+ })
180
+
181
+ afterAll(() => {
182
+ server.close()
183
+ })
184
+
185
+ describe('PickupAddress', () => {
186
+ beforeEach(() => {
187
+ jest.clearAllMocks()
188
+ mockGoToNextStep.mockClear()
189
+ // default to editing mode for pickup address
190
+ mockCheckoutState.step = mockCheckoutState.STEPS.PICKUP_ADDRESS
191
+ })
192
+
193
+ test('displays pickup address when available', async () => {
194
+ const pickupBasket = {
195
+ ...scapiBasketWithItem,
196
+ shipments: [
62
197
  {
63
- itemId: '7f9637386161502d31f4563db5',
64
- itemText: 'Long Sleeve Crew Neck',
65
- price: 19.18,
66
- productId: '701643070725M',
67
- productName: 'Long Sleeve Crew Neck',
68
- quantity: 2,
69
- shipmentId: 'me'
198
+ ...scapiBasketWithItem.shipments[0],
199
+ shipmentId: 'shipment-1',
200
+ shippingMethod: {c_storePickupEnabled: true},
201
+ c_fromStoreId: 'store-1'
70
202
  }
71
203
  ],
204
+ productItems: [
205
+ {
206
+ ...scapiBasketWithItem.productItems[0],
207
+ shipmentId: 'shipment-1'
208
+ }
209
+ ]
210
+ }
211
+
212
+ useCurrentBasket.mockReturnValue({
213
+ data: pickupBasket,
214
+ isLoading: false,
215
+ derivedData: buildDerivedData(pickupBasket)
216
+ })
217
+
218
+ useSelectedStore.mockReturnValue({
219
+ selectedStore: null
220
+ })
221
+
222
+ global.server.use(
223
+ rest.get('*/stores', (req, res, ctx) => {
224
+ return res(
225
+ ctx.json({
226
+ data: [
227
+ {
228
+ id: 'store-1',
229
+ name: 'Test Store',
230
+ address1: '123 Main Street',
231
+ city: 'San Francisco',
232
+ stateCode: 'CA',
233
+ postalCode: '94105',
234
+ countryCode: 'US',
235
+ phone: '555-123-4567',
236
+ storeHours: 'Mon-Fri: 9AM-6PM',
237
+ storeType: 'retail'
238
+ }
239
+ ]
240
+ })
241
+ )
242
+ })
243
+ )
244
+
245
+ renderWithProviders(<PickupAddress />)
246
+
247
+ await waitFor(() => {
248
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
249
+ })
250
+
251
+ expect(screen.getByText(/continue to payment/i)).toBeInTheDocument()
252
+
253
+ expect(screen.getByText('Store Information')).toBeInTheDocument()
254
+ expect(screen.getByText('Test Store 1')).toBeInTheDocument()
255
+ expect(screen.getByText('123 Main Street')).toBeInTheDocument()
256
+ expect(screen.getByText('San Francisco, CA 94105')).toBeInTheDocument()
257
+ })
258
+
259
+ test('renders product cards for products ready for pickup from one store', async () => {
260
+ const singleStoreBasket = {
261
+ ...scapiBasketWithItem,
72
262
  shipments: [
73
263
  {
74
- shipmentId: 'me',
75
- shipmentTotal: 25.17,
76
- shippingStatus: 'not_shipped',
77
- shippingTotal: 5.99
264
+ ...scapiBasketWithItem.shipments[0],
265
+ shipmentId: 'shipment-1',
266
+ shippingMethod: {c_storePickupEnabled: true},
267
+ c_fromStoreId: 'store-1'
78
268
  }
79
269
  ],
80
- c_fromStoreId: 'store-123'
81
- },
82
- derivedData: {
83
- hasBasket: true,
84
- totalItems: 2
270
+ productItems: [
271
+ {
272
+ ...scapiBasketWithItem.productItems[0],
273
+ itemId: 'item-1',
274
+ shipmentId: 'shipment-1',
275
+ productId: 'product-1',
276
+ quantity: 1,
277
+ productName: 'Pickup Product 1'
278
+ },
279
+ {
280
+ ...scapiBasketWithItem.productItems[0],
281
+ itemId: 'item-2',
282
+ shipmentId: 'shipment-1',
283
+ productId: 'product-2',
284
+ quantity: 2,
285
+ productName: 'Pickup Product 2'
286
+ }
287
+ ]
85
288
  }
86
- })
87
- }))
88
289
 
89
- jest.mock('@salesforce/retail-react-app/app/pages/checkout/util/checkout-context', () => ({
90
- useCheckout: () => ({
91
- step: 1,
92
- STEPS: {
93
- CONTACT_INFO: 0,
94
- PICKUP_ADDRESS: 1,
95
- SHIPPING_ADDRESS: 2,
96
- SHIPPING_OPTIONS: 3,
97
- PAYMENT: 4,
98
- REVIEW_ORDER: 5
99
- },
100
- goToStep: jest.fn()
290
+ useCurrentBasket.mockReturnValue({
291
+ data: singleStoreBasket,
292
+ isLoading: false,
293
+ derivedData: buildDerivedData(singleStoreBasket)
294
+ })
295
+
296
+ useSelectedStore.mockReturnValue({
297
+ selectedStore: null
298
+ })
299
+
300
+ global.server.use(
301
+ rest.get('*/stores', (req, res, ctx) => {
302
+ return res(
303
+ ctx.json({
304
+ data: [
305
+ {
306
+ id: 'store-1',
307
+ name: 'Test Store 1',
308
+ address1: '123 Main Street',
309
+ city: 'San Francisco',
310
+ stateCode: 'CA',
311
+ postalCode: '94105',
312
+ countryCode: 'US'
313
+ }
314
+ ]
315
+ })
316
+ )
317
+ })
318
+ )
319
+
320
+ renderWithProviders(<PickupAddress />)
321
+
322
+ await waitFor(() => {
323
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
324
+ })
325
+
326
+ // Product cards show product names and quantities
327
+ expect(screen.getByText('Pickup Product 1')).toBeInTheDocument()
328
+ expect(screen.getByText('Pickup Product 2')).toBeInTheDocument()
329
+ expect(screen.getByText('Qty: 1')).toBeInTheDocument()
330
+ expect(screen.getByText('Qty: 2')).toBeInTheDocument()
101
331
  })
102
- }))
103
332
 
104
- describe('PickupAddress', () => {
105
- beforeEach(() => {
106
- jest.resetModules()
107
- jest.clearAllMocks()
333
+ test('shows "Show Products" edit label button when not editing', async () => {
334
+ // Switch out of editing mode to summary mode
335
+ mockCheckoutState.step = mockCheckoutState.STEPS.SHIPPING_ADDRESS
336
+
337
+ const singlePickupBasket = {
338
+ ...scapiBasketWithItem,
339
+ shipments: [
340
+ {
341
+ ...scapiBasketWithItem.shipments[0],
342
+ shipmentId: 'shipment-1',
343
+ shippingMethod: {c_storePickupEnabled: true},
344
+ c_fromStoreId: 'store-1'
345
+ }
346
+ ],
347
+ productItems: [
348
+ {
349
+ ...scapiBasketWithItem.productItems[0],
350
+ itemId: 'item-1',
351
+ shipmentId: 'shipment-1',
352
+ productId: 'product-1',
353
+ quantity: 1,
354
+ productName: 'Pickup Product 1'
355
+ }
356
+ ]
357
+ }
358
+
359
+ useCurrentBasket.mockReturnValue({
360
+ data: singlePickupBasket,
361
+ isLoading: false,
362
+ derivedData: buildDerivedData(singlePickupBasket)
363
+ })
364
+
365
+ useSelectedStore.mockReturnValue({selectedStore: null})
366
+
367
+ global.server.use(
368
+ rest.get('*/stores', (req, res, ctx) => {
369
+ return res(
370
+ ctx.json({
371
+ data: [
372
+ {
373
+ id: 'store-1',
374
+ name: 'Test Store 1',
375
+ address1: '123 Main Street',
376
+ city: 'San Francisco',
377
+ stateCode: 'CA',
378
+ postalCode: '94105',
379
+ countryCode: 'US'
380
+ }
381
+ ]
382
+ })
383
+ )
384
+ })
385
+ )
386
+
387
+ renderWithProviders(<PickupAddress />)
388
+
389
+ await waitFor(() => {
390
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
391
+ })
392
+
393
+ // ToggleCard's edit button label
394
+ expect(screen.getByRole('button', {name: 'Show Products'})).toBeInTheDocument()
108
395
  })
109
396
 
110
- afterEach(() => {
111
- cleanup()
112
- jest.clearAllMocks()
397
+ test('continues to payment when button is clicked', async () => {
398
+ const pickupBasket = {
399
+ ...scapiBasketWithItem,
400
+ shipments: [
401
+ {
402
+ ...scapiBasketWithItem.shipments[0],
403
+ shipmentId: 'shipment-1',
404
+ shippingMethod: {c_storePickupEnabled: true},
405
+ c_fromStoreId: 'store-1'
406
+ }
407
+ ],
408
+ productItems: [
409
+ {
410
+ ...scapiBasketWithItem.productItems[0],
411
+ shipmentId: 'shipment-1'
412
+ }
413
+ ]
414
+ }
415
+
416
+ useCurrentBasket.mockReturnValue({
417
+ data: pickupBasket,
418
+ isLoading: false,
419
+ derivedData: buildDerivedData(pickupBasket)
420
+ })
421
+
422
+ useSelectedStore.mockReturnValue({
423
+ selectedStore: null
424
+ })
425
+
426
+ global.server.use(
427
+ rest.get('*/stores', (req, res, ctx) => {
428
+ return res(
429
+ ctx.json({
430
+ data: [
431
+ {
432
+ id: 'store-1',
433
+ name: 'Test Store',
434
+ address1: '123 Main Street',
435
+ city: 'San Francisco',
436
+ stateCode: 'CA',
437
+ postalCode: '94105',
438
+ countryCode: 'US',
439
+ phone: '555-123-4567',
440
+ storeHours: 'Mon-Fri: 9AM-6PM',
441
+ storeType: 'retail'
442
+ }
443
+ ]
444
+ })
445
+ )
446
+ })
447
+ )
448
+
449
+ const {user} = renderWithProviders(<PickupAddress />)
450
+
451
+ await waitFor(() => {
452
+ expect(screen.getByText(/continue to payment/i)).toBeInTheDocument()
453
+ })
454
+
455
+ await user.click(screen.getByText(/continue to payment/i))
456
+
457
+ await waitFor(() => {
458
+ expect(mockGoToNextStep).toHaveBeenCalled()
459
+ })
113
460
  })
114
461
 
115
- test('displays pickup address when available', async () => {
462
+ test('displays multiple pickup locations for multi-pickup orders', async () => {
463
+ const multiPickupBasket = {
464
+ ...scapiBasketWithItem,
465
+ shipments: [
466
+ {
467
+ ...scapiBasketWithItem.shipments[0],
468
+ shipmentId: 'shipment-1',
469
+ shippingMethod: {c_storePickupEnabled: true},
470
+ c_fromStoreId: 'store-1'
471
+ },
472
+ {
473
+ ...scapiBasketWithItem.shipments[0],
474
+ shipmentId: 'shipment-2',
475
+ shippingMethod: {c_storePickupEnabled: true},
476
+ c_fromStoreId: 'store-2'
477
+ }
478
+ ],
479
+ productItems: [
480
+ {
481
+ ...scapiBasketWithItem.productItems[0],
482
+ itemId: 'item-1',
483
+ shipmentId: 'shipment-1',
484
+ productId: 'product-1',
485
+ quantity: 2,
486
+ productName: 'Test Product 1'
487
+ },
488
+ {
489
+ ...scapiBasketWithItem.productItems[0],
490
+ itemId: 'item-2',
491
+ shipmentId: 'shipment-2',
492
+ productId: 'product-2',
493
+ quantity: 1,
494
+ productName: 'Test Product 2'
495
+ }
496
+ ]
497
+ }
498
+
499
+ useCurrentBasket.mockReturnValue({
500
+ data: multiPickupBasket,
501
+ isLoading: false,
502
+ derivedData: buildDerivedData(multiPickupBasket)
503
+ })
504
+
505
+ useSelectedStore.mockReturnValue({
506
+ selectedStore: null
507
+ })
508
+
509
+ global.server.use(
510
+ rest.get('*/stores', (req, res, ctx) => {
511
+ return res(
512
+ ctx.json({
513
+ data: [
514
+ {
515
+ id: 'store-1',
516
+ name: 'Test Store 1',
517
+ address1: '123 Main Street',
518
+ city: 'San Francisco',
519
+ stateCode: 'CA',
520
+ postalCode: '94105',
521
+ countryCode: 'US',
522
+ phone: '555-123-4567',
523
+ storeHours: 'Mon-Fri: 9AM-6PM',
524
+ storeType: 'retail'
525
+ },
526
+ {
527
+ id: 'store-2',
528
+ name: 'Test Store 2',
529
+ address1: '456 Oak Avenue',
530
+ city: 'Los Angeles',
531
+ stateCode: 'CA',
532
+ postalCode: '90210',
533
+ countryCode: 'US',
534
+ phone: '555-987-6543',
535
+ storeHours: 'Mon-Sat: 10AM-8PM',
536
+ storeType: 'retail'
537
+ }
538
+ ]
539
+ })
540
+ )
541
+ })
542
+ )
543
+
116
544
  renderWithProviders(<PickupAddress />)
117
545
 
118
546
  await waitFor(() => {
119
547
  expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
120
548
  })
121
549
 
122
- expect(screen.getByText('Store Information')).toBeInTheDocument()
123
- expect(screen.getByText('Continue to Payment')).toBeInTheDocument()
550
+ const storeInfoSections = screen.getAllByText('Store Information')
551
+ expect(storeInfoSections).toHaveLength(2)
552
+
553
+ // Check that both store names are displayed
554
+ expect(screen.getByText('Test Store 1')).toBeInTheDocument()
555
+ expect(screen.getByText('Test Store 2')).toBeInTheDocument()
124
556
 
557
+ // store addresses are displayed
125
558
  expect(screen.getByText('123 Main Street')).toBeInTheDocument()
559
+ expect(screen.getByText('456 Oak Avenue')).toBeInTheDocument()
126
560
  expect(screen.getByText('San Francisco, CA 94105')).toBeInTheDocument()
561
+ expect(screen.getByText('Los Angeles, CA 90210')).toBeInTheDocument()
562
+ expect(screen.getByText('Test Product 1')).toBeInTheDocument()
563
+ expect(screen.getByText('Test Product 2')).toBeInTheDocument()
564
+ expect(screen.getByText(/continue to payment/i)).toBeInTheDocument()
565
+ })
566
+
567
+ test('shows "Continue to Shipping Address" for mixed orders', async () => {
568
+ const mixedBasket = {
569
+ ...scapiBasketWithItem,
570
+ shipments: [
571
+ {
572
+ ...scapiBasketWithItem.shipments[0],
573
+ shipmentId: 'shipment-1',
574
+ shippingMethod: {c_storePickupEnabled: true},
575
+ c_fromStoreId: 'store-1'
576
+ },
577
+ {
578
+ ...scapiBasketWithItem.shipments[0],
579
+ shipmentId: 'shipment-2',
580
+ shippingMethod: {c_storePickupEnabled: false}
581
+ }
582
+ ],
583
+ productItems: [
584
+ {
585
+ ...scapiBasketWithItem.productItems[0],
586
+ shipmentId: 'shipment-1'
587
+ },
588
+ {
589
+ ...scapiBasketWithItem.productItems[0],
590
+ itemId: 'item-2',
591
+ shipmentId: 'shipment-2'
592
+ }
593
+ ]
594
+ }
595
+
596
+ useCurrentBasket.mockReturnValue({
597
+ data: mixedBasket,
598
+ isLoading: false,
599
+ derivedData: buildDerivedData(mixedBasket)
600
+ })
601
+
602
+ useSelectedStore.mockReturnValue({
603
+ selectedStore: null
604
+ })
605
+
606
+ global.server.use(
607
+ rest.get('*/stores', (req, res, ctx) => {
608
+ return res(
609
+ ctx.json({
610
+ data: [
611
+ {
612
+ id: 'store-1',
613
+ name: 'Test Store',
614
+ address1: '123 Main Street',
615
+ city: 'San Francisco',
616
+ stateCode: 'CA',
617
+ postalCode: '94105',
618
+ countryCode: 'US',
619
+ phone: '555-123-4567',
620
+ storeHours: 'Mon-Fri: 9AM-6PM',
621
+ storeType: 'retail'
622
+ }
623
+ ]
624
+ })
625
+ )
626
+ })
627
+ )
628
+
629
+ renderWithProviders(<PickupAddress />)
630
+
631
+ await waitFor(() => {
632
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
633
+ })
634
+
635
+ expect(screen.getByText(/continue to shipping address/i)).toBeInTheDocument()
127
636
  })
128
637
 
129
- test('submits pickup address and continues to payment', async () => {
638
+ test('continues to payment for multi pickup orders', async () => {
639
+ const multiPickupBasket = {
640
+ ...scapiBasketWithItem,
641
+ shipments: [
642
+ {
643
+ ...scapiBasketWithItem.shipments[0],
644
+ shipmentId: 'shipment-1',
645
+ shippingMethod: {c_storePickupEnabled: true},
646
+ c_fromStoreId: 'store-1'
647
+ },
648
+ {
649
+ ...scapiBasketWithItem.shipments[0],
650
+ shipmentId: 'shipment-2',
651
+ shippingMethod: {c_storePickupEnabled: true},
652
+ c_fromStoreId: 'store-2'
653
+ }
654
+ ],
655
+ productItems: [
656
+ {
657
+ ...scapiBasketWithItem.productItems[0],
658
+ itemId: 'item-1',
659
+ shipmentId: 'shipment-1',
660
+ productId: 'product-1',
661
+ quantity: 2,
662
+ productName: 'Test Product 1'
663
+ },
664
+ {
665
+ ...scapiBasketWithItem.productItems[0],
666
+ itemId: 'item-2',
667
+ shipmentId: 'shipment-2',
668
+ productId: 'product-2',
669
+ quantity: 1,
670
+ productName: 'Test Product 2'
671
+ }
672
+ ]
673
+ }
674
+
675
+ useCurrentBasket.mockReturnValue({
676
+ data: multiPickupBasket,
677
+ isLoading: false,
678
+ derivedData: buildDerivedData(multiPickupBasket)
679
+ })
680
+
681
+ useSelectedStore.mockReturnValue({
682
+ selectedStore: null
683
+ })
684
+
685
+ global.server.use(
686
+ rest.get('*/stores', (req, res, ctx) => {
687
+ return res(
688
+ ctx.json({
689
+ data: [
690
+ {
691
+ id: 'store-1',
692
+ name: 'Test Store 1',
693
+ address1: '123 Main Street',
694
+ city: 'San Francisco',
695
+ stateCode: 'CA',
696
+ postalCode: '94105',
697
+ countryCode: 'US',
698
+ phone: '555-123-4567',
699
+ storeHours: 'Mon-Fri: 9AM-6PM',
700
+ storeType: 'retail'
701
+ },
702
+ {
703
+ id: 'store-2',
704
+ name: 'Test Store 2',
705
+ address1: '456 Oak Avenue',
706
+ city: 'Los Angeles',
707
+ stateCode: 'CA',
708
+ postalCode: '90210',
709
+ countryCode: 'US',
710
+ phone: '555-987-6543',
711
+ storeHours: 'Mon-Sat: 10AM-8PM',
712
+ storeType: 'retail'
713
+ }
714
+ ]
715
+ })
716
+ )
717
+ })
718
+ )
719
+
130
720
  const {user} = renderWithProviders(<PickupAddress />)
131
721
 
132
722
  await waitFor(() => {
133
- expect(screen.getByText('Continue to Payment')).toBeInTheDocument()
723
+ expect(screen.getByText(/continue to payment/i)).toBeInTheDocument()
724
+ })
725
+ await user.click(screen.getByText(/continue to payment/i))
726
+ await waitFor(() => {
727
+ expect(mockGoToNextStep).toHaveBeenCalled()
728
+ })
729
+ })
730
+
731
+ test('continues to payment for single pickup order', async () => {
732
+ const singlePickupBasket = {
733
+ ...scapiBasketWithItem,
734
+ shipments: [
735
+ {
736
+ ...scapiBasketWithItem.shipments[0],
737
+ shipmentId: 'shipment-1',
738
+ shippingMethod: {c_storePickupEnabled: true},
739
+ c_fromStoreId: 'store-1'
740
+ }
741
+ ],
742
+ productItems: [
743
+ {
744
+ ...scapiBasketWithItem.productItems[0],
745
+ shipmentId: 'shipment-1'
746
+ }
747
+ ]
748
+ }
749
+
750
+ useCurrentBasket.mockReturnValue({
751
+ data: singlePickupBasket,
752
+ isLoading: false,
753
+ derivedData: buildDerivedData(singlePickupBasket)
754
+ })
755
+
756
+ useSelectedStore.mockReturnValue({
757
+ selectedStore: null
134
758
  })
135
759
 
136
- await user.click(screen.getByText('Continue to Payment'))
760
+ global.server.use(
761
+ rest.get('*/stores', (req, res, ctx) => {
762
+ return res(
763
+ ctx.json({
764
+ data: [
765
+ {
766
+ id: 'store-1',
767
+ name: 'Test Store 1',
768
+ address1: '123 Main Street',
769
+ city: 'San Francisco',
770
+ stateCode: 'CA',
771
+ postalCode: '94105',
772
+ countryCode: 'US',
773
+ phone: '555-123-4567',
774
+ storeHours: 'Mon-Fri: 9AM-6PM',
775
+ storeType: 'retail'
776
+ }
777
+ ]
778
+ })
779
+ )
780
+ })
781
+ )
137
782
 
783
+ const {user} = renderWithProviders(<PickupAddress />)
784
+
785
+ await waitFor(() => {
786
+ expect(screen.getByText(/continue to payment/i)).toBeInTheDocument()
787
+ })
788
+ await user.click(screen.getByText(/continue to payment/i))
138
789
  await waitFor(() => {
139
- expect(mockMutateAsync).toHaveBeenCalledWith({
140
- parameters: {
141
- basketId: 'e4547d1b21d01bf5ad92d30c9d',
142
- shipmentId: 'me',
143
- useAsBilling: false
790
+ expect(mockGoToNextStep).toHaveBeenCalled()
791
+ })
792
+ })
793
+
794
+ test('continues to shipping address for mixed pickup and delivery orders', async () => {
795
+ const mixedBasket = {
796
+ ...scapiBasketWithItem,
797
+ shipments: [
798
+ {
799
+ ...scapiBasketWithItem.shipments[0],
800
+ shipmentId: 'shipment-1',
801
+ shippingMethod: {c_storePickupEnabled: true},
802
+ c_fromStoreId: 'store-1'
144
803
  },
145
- body: {
146
- address1: '123 Main Street',
147
- city: 'San Francisco',
148
- countryCode: 'US',
149
- postalCode: '94105',
150
- stateCode: 'CA',
151
- firstName: 'Test Store',
152
- lastName: 'Pickup',
153
- phone: '555-123-4567'
804
+ {
805
+ ...scapiBasketWithItem.shipments[0],
806
+ shipmentId: 'shipment-2',
807
+ shippingMethod: {c_storePickupEnabled: true},
808
+ c_fromStoreId: 'store-2'
809
+ },
810
+ {
811
+ ...scapiBasketWithItem.shipments[0],
812
+ shipmentId: 'shipment-3',
813
+ shippingMethod: {c_storePickupEnabled: false}
154
814
  }
815
+ ],
816
+ productItems: [
817
+ {
818
+ ...scapiBasketWithItem.productItems[0],
819
+ itemId: 'item-1',
820
+ shipmentId: 'shipment-1',
821
+ productId: 'product-1',
822
+ quantity: 1,
823
+ productName: 'Pickup Product 1'
824
+ },
825
+ {
826
+ ...scapiBasketWithItem.productItems[0],
827
+ itemId: 'item-2',
828
+ shipmentId: 'shipment-2',
829
+ productId: 'product-2',
830
+ quantity: 1,
831
+ productName: 'Pickup Product 2'
832
+ },
833
+ {
834
+ ...scapiBasketWithItem.productItems[0],
835
+ itemId: 'item-3',
836
+ shipmentId: 'shipment-3',
837
+ productId: 'product-3',
838
+ quantity: 1,
839
+ productName: 'Delivery Product'
840
+ }
841
+ ]
842
+ }
843
+
844
+ useCurrentBasket.mockReturnValue({
845
+ data: mixedBasket,
846
+ isLoading: false,
847
+ derivedData: buildDerivedData(mixedBasket)
848
+ })
849
+
850
+ useSelectedStore.mockReturnValue({
851
+ selectedStore: null
852
+ })
853
+
854
+ global.server.use(
855
+ rest.get('*/stores', (req, res, ctx) => {
856
+ return res(
857
+ ctx.json({
858
+ data: [
859
+ {
860
+ id: 'store-1',
861
+ name: 'Test Store 1',
862
+ address1: '123 Main Street',
863
+ city: 'San Francisco',
864
+ stateCode: 'CA',
865
+ postalCode: '94105',
866
+ countryCode: 'US',
867
+ phone: '555-123-4567',
868
+ storeHours: 'Mon-Fri: 9AM-6PM',
869
+ storeType: 'retail'
870
+ },
871
+ {
872
+ id: 'store-2',
873
+ name: 'Test Store 2',
874
+ address1: '456 Oak Avenue',
875
+ city: 'Los Angeles',
876
+ stateCode: 'CA',
877
+ postalCode: '90210',
878
+ countryCode: 'US',
879
+ phone: '555-987-6543',
880
+ storeHours: 'Mon-Sat: 10AM-8PM',
881
+ storeType: 'retail'
882
+ }
883
+ ]
884
+ })
885
+ )
155
886
  })
887
+ )
888
+
889
+ const {user} = renderWithProviders(<PickupAddress />)
890
+ await waitFor(() => {
891
+ expect(screen.getByText(/continue to shipping address/i)).toBeInTheDocument()
892
+ })
893
+ await user.click(screen.getByText(/continue to shipping address/i))
894
+ await waitFor(() => {
895
+ expect(mockGoToNextStep).toHaveBeenCalled()
896
+ })
897
+ })
898
+
899
+ test('renders product items are rendered in a mixed basket 1 pickup', async () => {
900
+ const pickupBasket = {
901
+ ...scapiBasketWithItem,
902
+ shipments: [
903
+ {
904
+ ...scapiBasketWithItem.shipments[0],
905
+ shipmentId: 'shipment-1',
906
+ shippingMethod: {c_storePickupEnabled: true},
907
+ c_fromStoreId: 'store-1'
908
+ },
909
+ {
910
+ ...scapiBasketWithItem.shipments[0],
911
+ shipmentId: 'shipment-2',
912
+ shippingMethod: {c_storePickupEnabled: false}
913
+ }
914
+ ],
915
+ productItems: [
916
+ {
917
+ ...scapiBasketWithItem.productItems[0],
918
+ itemId: 'item-1',
919
+ shipmentId: 'shipment-1',
920
+ productId: 'product-1',
921
+ quantity: 2,
922
+ productName: 'Test Product 1'
923
+ }
924
+ ]
925
+ }
926
+
927
+ useCurrentBasket.mockReturnValue({
928
+ data: pickupBasket,
929
+ isLoading: false,
930
+ derivedData: buildDerivedData(pickupBasket)
931
+ })
932
+
933
+ useSelectedStore.mockReturnValue({
934
+ selectedStore: null
935
+ })
936
+
937
+ global.server.use(
938
+ rest.get('*/stores', (req, res, ctx) => {
939
+ return res(
940
+ ctx.json({
941
+ data: [
942
+ {
943
+ id: 'store-1',
944
+ name: 'Test Store',
945
+ address1: '123 Main Street',
946
+ city: 'San Francisco',
947
+ stateCode: 'CA',
948
+ postalCode: '94105',
949
+ countryCode: 'US',
950
+ phone: '555-123-4567',
951
+ storeHours: 'Mon-Fri: 9AM-6PM',
952
+ storeType: 'retail'
953
+ }
954
+ ]
955
+ })
956
+ )
957
+ })
958
+ )
959
+ renderWithProviders(<PickupAddress />)
960
+ await waitFor(() => {
961
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
962
+ })
963
+ expect(screen.getByText('Test Product 1')).toBeInTheDocument()
964
+ expect(screen.getByText('Qty: 2')).toBeInTheDocument()
965
+ })
966
+
967
+ test('renders multiple products in mixed basket 1 pickup', async () => {
968
+ const multiProductBasket = {
969
+ ...scapiBasketWithItem,
970
+ shipments: [
971
+ {
972
+ ...scapiBasketWithItem.shipments[0],
973
+ shipmentId: 'shipment-1',
974
+ shippingMethod: {c_storePickupEnabled: true},
975
+ c_fromStoreId: 'store-1'
976
+ },
977
+ {
978
+ ...scapiBasketWithItem.shipments[0],
979
+ shipmentId: 'shipment-2',
980
+ shippingMethod: {c_storePickupEnabled: false}
981
+ }
982
+ ],
983
+ productItems: [
984
+ {
985
+ ...scapiBasketWithItem.productItems[0],
986
+ itemId: 'item-1',
987
+ shipmentId: 'shipment-1',
988
+ productId: 'product-1',
989
+ quantity: 1,
990
+ productName: 'Regular Product 1'
991
+ },
992
+ {
993
+ ...scapiBasketWithItem.productItems[0],
994
+ itemId: 'item-2',
995
+ shipmentId: 'shipment-1',
996
+ productId: 'product-2',
997
+ quantity: 3,
998
+ productName: 'Regular Product 2'
999
+ },
1000
+ {
1001
+ ...scapiBasketWithItem.productItems[0],
1002
+ itemId: 'item-3',
1003
+ shipmentId: 'shipment-1',
1004
+ productId: 'bonus-1',
1005
+ quantity: 1,
1006
+ productName: 'Bonus Product 1',
1007
+ bonusProductLineItem: true
1008
+ }
1009
+ ]
1010
+ }
1011
+
1012
+ useCurrentBasket.mockReturnValue({
1013
+ data: multiProductBasket,
1014
+ isLoading: false,
1015
+ derivedData: buildDerivedData(multiProductBasket)
1016
+ })
1017
+
1018
+ useSelectedStore.mockReturnValue({
1019
+ selectedStore: null
1020
+ })
1021
+
1022
+ global.server.use(
1023
+ rest.get('*/stores', (req, res, ctx) => {
1024
+ return res(
1025
+ ctx.json({
1026
+ data: [
1027
+ {
1028
+ id: 'store-1',
1029
+ name: 'Test Store',
1030
+ address1: '123 Main Street',
1031
+ city: 'San Francisco',
1032
+ stateCode: 'CA',
1033
+ postalCode: '94105',
1034
+ countryCode: 'US',
1035
+ phone: '555-123-4567',
1036
+ storeHours: 'Mon-Fri: 9AM-6PM',
1037
+ storeType: 'retail'
1038
+ }
1039
+ ]
1040
+ })
1041
+ )
1042
+ })
1043
+ )
1044
+
1045
+ renderWithProviders(<PickupAddress />)
1046
+ await waitFor(() => {
1047
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
1048
+ })
1049
+
1050
+ expect(screen.getByText('Regular Product 1')).toBeInTheDocument()
1051
+ expect(screen.getByText('Regular Product 2')).toBeInTheDocument()
1052
+ expect(screen.getByText('Bonus Items')).toBeInTheDocument()
1053
+ expect(screen.getByText('Bonus Product 1')).toBeInTheDocument()
1054
+ })
1055
+
1056
+ test('product rendering on multiple pickup stores in checkout', async () => {
1057
+ const multiStoreBasket = {
1058
+ ...scapiBasketWithItem,
1059
+ shipments: [
1060
+ {
1061
+ ...scapiBasketWithItem.shipments[0],
1062
+ shipmentId: 'shipment-1',
1063
+ shippingMethod: {c_storePickupEnabled: true},
1064
+ c_fromStoreId: 'store-1'
1065
+ },
1066
+ {
1067
+ ...scapiBasketWithItem.shipments[0],
1068
+ shipmentId: 'shipment-2',
1069
+ shippingMethod: {c_storePickupEnabled: true},
1070
+ c_fromStoreId: 'store-2'
1071
+ }
1072
+ ],
1073
+ productItems: [
1074
+ {
1075
+ ...scapiBasketWithItem.productItems[0],
1076
+ itemId: 'item-1',
1077
+ shipmentId: 'shipment-1',
1078
+ productId: 'product-1',
1079
+ quantity: 2,
1080
+ productName: 'Store 1 Product'
1081
+ },
1082
+ {
1083
+ ...scapiBasketWithItem.productItems[0],
1084
+ itemId: 'item-2',
1085
+ shipmentId: 'shipment-2',
1086
+ productId: 'product-2',
1087
+ quantity: 1,
1088
+ productName: 'Store 2 Product'
1089
+ }
1090
+ ]
1091
+ }
1092
+
1093
+ useCurrentBasket.mockReturnValue({
1094
+ data: multiStoreBasket,
1095
+ isLoading: false,
1096
+ derivedData: buildDerivedData(multiStoreBasket)
1097
+ })
1098
+
1099
+ useSelectedStore.mockReturnValue({
1100
+ selectedStore: null
1101
+ })
1102
+
1103
+ global.server.use(
1104
+ rest.get('*/stores', (req, res, ctx) => {
1105
+ return res(
1106
+ ctx.json({
1107
+ data: [
1108
+ {
1109
+ id: 'store-1',
1110
+ name: 'Test Store 1',
1111
+ address1: '123 Main Street',
1112
+ city: 'San Francisco',
1113
+ stateCode: 'CA',
1114
+ postalCode: '94105',
1115
+ countryCode: 'US',
1116
+ phone: '555-123-4567',
1117
+ storeHours: 'Mon-Fri: 9AM-6PM',
1118
+ storeType: 'retail'
1119
+ },
1120
+ {
1121
+ id: 'store-2',
1122
+ name: 'Test Store 2',
1123
+ address1: '456 Oak Avenue',
1124
+ city: 'Los Angeles',
1125
+ stateCode: 'CA',
1126
+ postalCode: '90210',
1127
+ countryCode: 'US',
1128
+ phone: '555-987-6543',
1129
+ storeHours: 'Mon-Sat: 10AM-8PM',
1130
+ storeType: 'retail'
1131
+ }
1132
+ ]
1133
+ })
1134
+ )
1135
+ })
1136
+ )
1137
+
1138
+ renderWithProviders(<PickupAddress />)
1139
+ await waitFor(() => {
1140
+ expect(screen.getByText('Pickup Address & Information')).toBeInTheDocument()
156
1141
  })
1142
+ // both stores
1143
+ const storeInfoSections = screen.getAllByText('Store Information')
1144
+ expect(storeInfoSections).toHaveLength(2)
1145
+ expect(screen.getByText('Test Store 1')).toBeInTheDocument()
1146
+ expect(screen.getByText('Test Store 2')).toBeInTheDocument()
1147
+ // each store pdts
1148
+ expect(screen.getByText('Store 1 Product')).toBeInTheDocument()
1149
+ expect(screen.getByText('Store 2 Product')).toBeInTheDocument()
157
1150
  })
158
1151
  })