@merchi/cart 1.4.61 → 1.4.63

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.
@@ -115,6 +115,7 @@ describe('cart load and replacement failures', function () {
115
115
  token: 'new-token'
116
116
  }
117
117
  });
118
+ getCartCookie.mockResolvedValue(['42', 'saved-token']);
118
119
  });
119
120
  afterEach(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
120
121
  return _regenerator().w(function (_context2) {
@@ -140,15 +141,15 @@ describe('cart load and replacement failures', function () {
140
141
  return _mount.apply(this, arguments);
141
142
  }
142
143
  function _mount() {
143
- _mount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(error) {
144
- return _regenerator().w(function (_context11) {
145
- while (1) switch (_context11.n) {
144
+ _mount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(error) {
145
+ return _regenerator().w(function (_context29) {
146
+ while (1) switch (_context29.n) {
146
147
  case 0:
147
148
  mockGet.mockRejectedValue(error);
148
- _context11.n = 1;
149
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
150
- return _regenerator().w(function (_context10) {
151
- while (1) switch (_context10.n) {
149
+ _context29.n = 1;
150
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28() {
151
+ return _regenerator().w(function (_context28) {
152
+ while (1) switch (_context28.n) {
152
153
  case 0:
153
154
  root.render(/*#__PURE__*/_jsx(CartProvider, {
154
155
  domainId: 5,
@@ -162,14 +163,14 @@ describe('cart load and replacement failures', function () {
162
163
  children: /*#__PURE__*/_jsx(Probe, {})
163
164
  }));
164
165
  case 1:
165
- return _context10.a(2);
166
+ return _context28.a(2);
166
167
  }
167
- }, _callee10);
168
+ }, _callee28);
168
169
  })));
169
170
  case 1:
170
- return _context11.a(2);
171
+ return _context29.a(2);
171
172
  }
172
- }, _callee11);
173
+ }, _callee29);
173
174
  }));
174
175
  return _mount.apply(this, arguments);
175
176
  }
@@ -177,9 +178,9 @@ describe('cart load and replacement failures', function () {
177
178
  return _mountSavedCart.apply(this, arguments);
178
179
  }
179
180
  function _mountSavedCart() {
180
- _mountSavedCart = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
181
- return _regenerator().w(function (_context14) {
182
- while (1) switch (_context14.n) {
181
+ _mountSavedCart = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
182
+ return _regenerator().w(function (_context32) {
183
+ while (1) switch (_context32.n) {
183
184
  case 0:
184
185
  mockGet.mockResolvedValue({
185
186
  toJson: function toJson() {
@@ -192,10 +193,10 @@ describe('cart load and replacement failures', function () {
192
193
  };
193
194
  }
194
195
  });
195
- _context14.n = 1;
196
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
197
- return _regenerator().w(function (_context12) {
198
- while (1) switch (_context12.n) {
196
+ _context32.n = 1;
197
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
198
+ return _regenerator().w(function (_context30) {
199
+ while (1) switch (_context30.n) {
199
200
  case 0:
200
201
  root.render(/*#__PURE__*/_jsx(CartProvider, {
201
202
  domainId: 5,
@@ -203,27 +204,321 @@ describe('cart load and replacement failures', function () {
203
204
  children: /*#__PURE__*/_jsx(Probe, {})
204
205
  }));
205
206
  case 1:
206
- return _context12.a(2);
207
+ return _context30.a(2);
207
208
  }
208
- }, _callee12);
209
+ }, _callee30);
209
210
  })));
210
211
  case 1:
211
- _context14.n = 2;
212
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
213
- return _regenerator().w(function (_context13) {
214
- while (1) switch (_context13.n) {
212
+ _context32.n = 2;
213
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31() {
214
+ return _regenerator().w(function (_context31) {
215
+ while (1) switch (_context31.n) {
215
216
  case 0:
216
- return _context13.a(2, context.setActiveTabIndex(tabIdClearCart));
217
+ return _context31.a(2, context.setActiveTabIndex(tabIdClearCart));
217
218
  }
218
- }, _callee13);
219
+ }, _callee31);
219
220
  })));
220
221
  case 2:
221
- return _context14.a(2);
222
+ return _context32.a(2);
222
223
  }
223
- }, _callee14);
224
+ }, _callee32);
224
225
  }));
225
226
  return _mountSavedCart.apply(this, arguments);
226
227
  }
228
+ it('shares cold initialization with opening the modal and concurrent getCart callers', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
229
+ var finish, first, second;
230
+ return _regenerator().w(function (_context6) {
231
+ while (1) switch (_context6.n) {
232
+ case 0:
233
+ getCartCookie.mockResolvedValue(undefined);
234
+ mockPost.mockImplementationOnce(function () {
235
+ return new Promise(function (resolve) {
236
+ finish = resolve;
237
+ });
238
+ });
239
+ _context6.n = 1;
240
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
241
+ return _regenerator().w(function (_context3) {
242
+ while (1) switch (_context3.n) {
243
+ case 0:
244
+ return _context3.a(2, root.render(/*#__PURE__*/_jsx(CartProvider, {
245
+ domainId: 5,
246
+ createCartAndCookie: function createCartAndCookie() {},
247
+ children: /*#__PURE__*/_jsx(Probe, {})
248
+ })));
249
+ }
250
+ }, _callee3);
251
+ })));
252
+ case 1:
253
+ _context6.n = 2;
254
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
255
+ return _regenerator().w(function (_context4) {
256
+ while (1) switch (_context4.n) {
257
+ case 0:
258
+ context.toggleCartModal();
259
+ first = window.getCart();
260
+ second = window.getCart();
261
+ case 1:
262
+ return _context4.a(2);
263
+ }
264
+ }, _callee4);
265
+ })));
266
+ case 2:
267
+ expect(mockPost).toHaveBeenCalledTimes(1);
268
+ expect(context.fetchingCart).toBe(true);
269
+ _context6.n = 3;
270
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
271
+ return _regenerator().w(function (_context5) {
272
+ while (1) switch (_context5.n) {
273
+ case 0:
274
+ finish({
275
+ cart: {
276
+ id: 99,
277
+ token: 'new-token'
278
+ }
279
+ });
280
+ _context5.n = 1;
281
+ return Promise.all([first, second]);
282
+ case 1:
283
+ return _context5.a(2);
284
+ }
285
+ }, _callee5);
286
+ })));
287
+ case 3:
288
+ expect(context.cart.id).toBe(99);
289
+ expect(context.fetchingCart).toBe(false);
290
+ expect(setCartCookie).toHaveBeenCalledTimes(1);
291
+ case 4:
292
+ return _context6.a(2);
293
+ }
294
+ }, _callee6);
295
+ })));
296
+ it('shares an active saved-cart read and allows a later refresh', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
297
+ var finish, saved, read;
298
+ return _regenerator().w(function (_context1) {
299
+ while (1) switch (_context1.n) {
300
+ case 0:
301
+ saved = {
302
+ toJson: function toJson() {
303
+ return {
304
+ id: 42,
305
+ isTest: false,
306
+ cartItems: [{
307
+ id: 7
308
+ }]
309
+ };
310
+ }
311
+ };
312
+ mockGet.mockImplementationOnce(function () {
313
+ return new Promise(function (resolve) {
314
+ finish = resolve;
315
+ });
316
+ }).mockResolvedValue(saved);
317
+ _context1.n = 1;
318
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
319
+ return _regenerator().w(function (_context7) {
320
+ while (1) switch (_context7.n) {
321
+ case 0:
322
+ return _context7.a(2, root.render(/*#__PURE__*/_jsx(CartProvider, {
323
+ domainId: 5,
324
+ createCartAndCookie: function createCartAndCookie() {},
325
+ children: /*#__PURE__*/_jsx(Probe, {})
326
+ })));
327
+ }
328
+ }, _callee7);
329
+ })));
330
+ case 1:
331
+ _context1.n = 2;
332
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
333
+ return _regenerator().w(function (_context8) {
334
+ while (1) switch (_context8.n) {
335
+ case 0:
336
+ context.toggleCartModal();
337
+ read = window.getCart();
338
+ case 1:
339
+ return _context8.a(2);
340
+ }
341
+ }, _callee8);
342
+ })));
343
+ case 2:
344
+ expect(mockGet).toHaveBeenCalledTimes(1);
345
+ _context1.n = 3;
346
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
347
+ return _regenerator().w(function (_context9) {
348
+ while (1) switch (_context9.n) {
349
+ case 0:
350
+ finish(saved);
351
+ _context9.n = 1;
352
+ return read;
353
+ case 1:
354
+ return _context9.a(2);
355
+ }
356
+ }, _callee9);
357
+ })));
358
+ case 3:
359
+ _context1.n = 4;
360
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
361
+ return _regenerator().w(function (_context0) {
362
+ while (1) switch (_context0.n) {
363
+ case 0:
364
+ _context0.n = 1;
365
+ return window.getCart();
366
+ case 1:
367
+ return _context0.a(2);
368
+ }
369
+ }, _callee0);
370
+ })));
371
+ case 4:
372
+ expect(mockGet).toHaveBeenCalledTimes(2);
373
+ expect(mockPost).not.toHaveBeenCalled();
374
+ expect(context.cart.cartItems).toHaveLength(1);
375
+ case 5:
376
+ return _context1.a(2);
377
+ }
378
+ }, _callee1);
379
+ })));
380
+ it('releases failed initialization so an explicit retry can create the cart', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
381
+ return _regenerator().w(function (_context12) {
382
+ while (1) switch (_context12.n) {
383
+ case 0:
384
+ getCartCookie.mockResolvedValue(undefined);
385
+ mockPost.mockRejectedValueOnce(new TypeError('Failed to fetch'));
386
+ _context12.n = 1;
387
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
388
+ return _regenerator().w(function (_context10) {
389
+ while (1) switch (_context10.n) {
390
+ case 0:
391
+ return _context10.a(2, root.render(/*#__PURE__*/_jsx(CartProvider, {
392
+ domainId: 5,
393
+ createCartAndCookie: function createCartAndCookie() {},
394
+ children: /*#__PURE__*/_jsx(Probe, {})
395
+ })));
396
+ }
397
+ }, _callee10);
398
+ })));
399
+ case 1:
400
+ expect(mockPost).toHaveBeenCalledTimes(1);
401
+ expect(context.fetchingCart).toBe(false);
402
+ _context12.n = 2;
403
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
404
+ return _regenerator().w(function (_context11) {
405
+ while (1) switch (_context11.n) {
406
+ case 0:
407
+ _context11.n = 1;
408
+ return Promise.all([window.getCart(), window.getCart()]);
409
+ case 1:
410
+ return _context11.a(2);
411
+ }
412
+ }, _callee11);
413
+ })));
414
+ case 2:
415
+ expect(mockPost).toHaveBeenCalledTimes(2);
416
+ expect(context.cart.id).toBe(99);
417
+ expect(context.fetchingCart).toBe(false);
418
+ case 3:
419
+ return _context12.a(2);
420
+ }
421
+ }, _callee12);
422
+ })));
423
+ it('initializes a changed domain independently of the previous pending domain', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
424
+ var finish, view, current;
425
+ return _regenerator().w(function (_context18) {
426
+ while (1) switch (_context18.n) {
427
+ case 0:
428
+ finish = {};
429
+ getCartCookie.mockImplementation(function (id) {
430
+ return Promise.resolve([String(id), 'token']);
431
+ });
432
+ mockGet.mockImplementation(function (id) {
433
+ return new Promise(function (resolve) {
434
+ finish[id] = resolve;
435
+ });
436
+ });
437
+ view = function view(id) {
438
+ return /*#__PURE__*/_jsx(CartProvider, {
439
+ domainId: id,
440
+ createCartAndCookie: function createCartAndCookie() {},
441
+ children: /*#__PURE__*/_jsx(Probe, {})
442
+ });
443
+ };
444
+ _context18.n = 1;
445
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
446
+ return _regenerator().w(function (_context13) {
447
+ while (1) switch (_context13.n) {
448
+ case 0:
449
+ return _context13.a(2, root.render(view(5)));
450
+ }
451
+ }, _callee13);
452
+ })));
453
+ case 1:
454
+ _context18.n = 2;
455
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
456
+ return _regenerator().w(function (_context14) {
457
+ while (1) switch (_context14.n) {
458
+ case 0:
459
+ return _context14.a(2, root.render(view(6)));
460
+ }
461
+ }, _callee14);
462
+ })));
463
+ case 2:
464
+ expect(mockGet).toHaveBeenCalledTimes(2);
465
+ _context18.n = 3;
466
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
467
+ return _regenerator().w(function (_context15) {
468
+ while (1) switch (_context15.n) {
469
+ case 0:
470
+ return _context15.a(2, finish[5]({
471
+ toJson: function toJson() {
472
+ return {
473
+ id: 5,
474
+ isTest: false
475
+ };
476
+ }
477
+ }));
478
+ }
479
+ }, _callee15);
480
+ })));
481
+ case 3:
482
+ _context18.n = 4;
483
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
484
+ return _regenerator().w(function (_context16) {
485
+ while (1) switch (_context16.n) {
486
+ case 0:
487
+ current = window.getCart();
488
+ case 1:
489
+ return _context16.a(2);
490
+ }
491
+ }, _callee16);
492
+ })));
493
+ case 4:
494
+ expect(mockGet).toHaveBeenCalledTimes(2);
495
+ _context18.n = 5;
496
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
497
+ return _regenerator().w(function (_context17) {
498
+ while (1) switch (_context17.n) {
499
+ case 0:
500
+ finish[6]({
501
+ toJson: function toJson() {
502
+ return {
503
+ id: 6,
504
+ isTest: false
505
+ };
506
+ }
507
+ });
508
+ _context17.n = 1;
509
+ return current;
510
+ case 1:
511
+ return _context17.a(2);
512
+ }
513
+ }, _callee17);
514
+ })));
515
+ case 5:
516
+ expect(context.cart.id).toBe(6);
517
+ case 6:
518
+ return _context18.a(2);
519
+ }
520
+ }, _callee18);
521
+ })));
227
522
  it.each([new TypeError('Load failed'), {
228
523
  statusCode: 502,
229
524
  message: 'Gateway unavailable'
@@ -231,11 +526,11 @@ describe('cart load and replacement failures', function () {
231
526
  statusCode: 403,
232
527
  message: 'Forbidden'
233
528
  }])('preserves the saved cart and never POSTs a replacement after %s', /*#__PURE__*/function () {
234
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(error) {
235
- return _regenerator().w(function (_context3) {
236
- while (1) switch (_context3.n) {
529
+ var _ref19 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(error) {
530
+ return _regenerator().w(function (_context19) {
531
+ while (1) switch (_context19.n) {
237
532
  case 0:
238
- _context3.n = 1;
533
+ _context19.n = 1;
239
534
  return mount(error);
240
535
  case 1:
241
536
  expect(getCartCookie).toHaveBeenCalledWith(5);
@@ -251,20 +546,20 @@ describe('cart load and replacement failures', function () {
251
546
  expect(context.fetchingCart).toBe(false);
252
547
  expect(reportCartFailure).toHaveBeenCalledWith(error, CART_FAILURE_SOURCES.load);
253
548
  case 2:
254
- return _context3.a(2);
549
+ return _context19.a(2);
255
550
  }
256
- }, _callee3);
551
+ }, _callee19);
257
552
  }));
258
553
  return function (_x2) {
259
- return _ref3.apply(this, arguments);
554
+ return _ref19.apply(this, arguments);
260
555
  };
261
556
  }());
262
557
  it.each([404, 410])('replaces a genuinely missing cart after HTTP %s', /*#__PURE__*/function () {
263
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(statusCode) {
264
- return _regenerator().w(function (_context4) {
265
- while (1) switch (_context4.n) {
558
+ var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(statusCode) {
559
+ return _regenerator().w(function (_context20) {
560
+ while (1) switch (_context20.n) {
266
561
  case 0:
267
- _context4.n = 1;
562
+ _context20.n = 1;
268
563
  return mount({
269
564
  statusCode: statusCode
270
565
  });
@@ -275,19 +570,19 @@ describe('cart load and replacement failures', function () {
275
570
  }));
276
571
  expect(setCartCookie).toHaveBeenCalledTimes(1);
277
572
  case 2:
278
- return _context4.a(2);
573
+ return _context20.a(2);
279
574
  }
280
- }, _callee4);
575
+ }, _callee20);
281
576
  }));
282
577
  return function (_x3) {
283
- return _ref4.apply(this, arguments);
578
+ return _ref20.apply(this, arguments);
284
579
  };
285
580
  }());
286
- it('allows an explicit retry to restore the same cart without creating another', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
287
- return _regenerator().w(function (_context6) {
288
- while (1) switch (_context6.n) {
581
+ it('allows an explicit retry to restore the same cart without creating another', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
582
+ return _regenerator().w(function (_context22) {
583
+ while (1) switch (_context22.n) {
289
584
  case 0:
290
- _context6.n = 1;
585
+ _context22.n = 1;
291
586
  return mount(new TypeError('Load failed'));
292
587
  case 1:
293
588
  mockGet.mockResolvedValue({
@@ -301,50 +596,50 @@ describe('cart load and replacement failures', function () {
301
596
  };
302
597
  }
303
598
  });
304
- _context6.n = 2;
305
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
306
- return _regenerator().w(function (_context5) {
307
- while (1) switch (_context5.n) {
599
+ _context22.n = 2;
600
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
601
+ return _regenerator().w(function (_context21) {
602
+ while (1) switch (_context21.n) {
308
603
  case 0:
309
- _context5.n = 1;
604
+ _context21.n = 1;
310
605
  return window.getCart();
311
606
  case 1:
312
- return _context5.a(2);
607
+ return _context21.a(2);
313
608
  }
314
- }, _callee5);
609
+ }, _callee21);
315
610
  })));
316
611
  case 2:
317
612
  expect(context.cart.id).toBe(42);
318
613
  expect(context.cart.cartItems).toHaveLength(1);
319
614
  expect(mockPost).not.toHaveBeenCalled();
320
615
  case 3:
321
- return _context6.a(2);
616
+ return _context22.a(2);
322
617
  }
323
- }, _callee6);
618
+ }, _callee22);
324
619
  })));
325
620
  it.each([new TypeError('Failed to fetch'), {
326
621
  statusCode: 503,
327
622
  message: 'Service unavailable'
328
623
  }, null, undefined])('keeps the clear-cart panel and saved cart when replacement fails with %s', /*#__PURE__*/function () {
329
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(error) {
330
- return _regenerator().w(function (_context8) {
331
- while (1) switch (_context8.n) {
624
+ var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(error) {
625
+ return _regenerator().w(function (_context24) {
626
+ while (1) switch (_context24.n) {
332
627
  case 0:
333
- _context8.n = 1;
628
+ _context24.n = 1;
334
629
  return mountSavedCart();
335
630
  case 1:
336
631
  mockPost.mockRejectedValueOnce(error);
337
- _context8.n = 2;
338
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
339
- return _regenerator().w(function (_context7) {
340
- while (1) switch (_context7.n) {
632
+ _context24.n = 2;
633
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
634
+ return _regenerator().w(function (_context23) {
635
+ while (1) switch (_context23.n) {
341
636
  case 0:
342
- _context7.n = 1;
637
+ _context23.n = 1;
343
638
  return context.clearCart();
344
639
  case 1:
345
- return _context7.a(2);
640
+ return _context23.a(2);
346
641
  }
347
- }, _callee7);
642
+ }, _callee23);
348
643
  })));
349
644
  case 2:
350
645
  expect(context.activeTabIndex).toBe(tabIdClearCart);
@@ -362,47 +657,47 @@ describe('cart load and replacement failures', function () {
362
657
  expect(context.alert.message).toBe((error === null || error === void 0 ? void 0 : error.message) || 'Unable to fetch cart.');
363
658
  expect(context.fetchingCart).toBe(false);
364
659
  case 3:
365
- return _context8.a(2);
660
+ return _context24.a(2);
366
661
  }
367
- }, _callee8);
662
+ }, _callee24);
368
663
  }));
369
664
  return function (_x4) {
370
- return _ref7.apply(this, arguments);
665
+ return _ref23.apply(this, arguments);
371
666
  };
372
667
  }());
373
- it('finishes clearing only after an explicit retry successfully creates the replacement', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
374
- return _regenerator().w(function (_context1) {
375
- while (1) switch (_context1.n) {
668
+ it('finishes clearing only after an explicit retry successfully creates the replacement', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
669
+ return _regenerator().w(function (_context27) {
670
+ while (1) switch (_context27.n) {
376
671
  case 0:
377
- _context1.n = 1;
672
+ _context27.n = 1;
378
673
  return mountSavedCart();
379
674
  case 1:
380
675
  mockPost.mockRejectedValueOnce(new TypeError('Failed to fetch'));
381
- _context1.n = 2;
382
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
383
- return _regenerator().w(function (_context9) {
384
- while (1) switch (_context9.n) {
676
+ _context27.n = 2;
677
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
678
+ return _regenerator().w(function (_context25) {
679
+ while (1) switch (_context25.n) {
385
680
  case 0:
386
- _context9.n = 1;
681
+ _context25.n = 1;
387
682
  return context.clearCart();
388
683
  case 1:
389
- return _context9.a(2);
684
+ return _context25.a(2);
390
685
  }
391
- }, _callee9);
686
+ }, _callee25);
392
687
  })));
393
688
  case 2:
394
689
  expect(context.activeTabIndex).toBe(tabIdClearCart);
395
- _context1.n = 3;
396
- return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
397
- return _regenerator().w(function (_context0) {
398
- while (1) switch (_context0.n) {
690
+ _context27.n = 3;
691
+ return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
692
+ return _regenerator().w(function (_context26) {
693
+ while (1) switch (_context26.n) {
399
694
  case 0:
400
- _context0.n = 1;
695
+ _context26.n = 1;
401
696
  return context.clearCart();
402
697
  case 1:
403
- return _context0.a(2);
698
+ return _context26.a(2);
404
699
  }
405
- }, _callee0);
700
+ }, _callee26);
406
701
  })));
407
702
  case 3:
408
703
  expect(mockPost).toHaveBeenCalledTimes(2);
@@ -412,8 +707,8 @@ describe('cart load and replacement failures', function () {
412
707
  expect(context.alert.show).toBe(false);
413
708
  expect(context.fetchingCart).toBe(false);
414
709
  case 4:
415
- return _context1.a(2);
710
+ return _context27.a(2);
416
711
  }
417
- }, _callee1);
712
+ }, _callee27);
418
713
  })));
419
714
  });