@managesome/eposmatic-toolkit 0.2.714 → 0.2.716
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/lib/helpers/utils/halfhalf-setup-helpers.d.ts +7 -0
- package/lib/helpers/utils/halfhalf-setup-helpers.js +18 -7
- package/lib/helpers/utils/specials-helpers.d.ts +1 -1
- package/lib/helpers/utils/specials-helpers.js +30 -5
- package/lib/tests/specials-halfhalf-pricing.test.js +113 -10
- package/package.json +1 -1
|
@@ -59,6 +59,13 @@ export interface IConvertHalfHalfToItemOptions {
|
|
|
59
59
|
* special and apply whether an item is picked directly or inside a half-half.
|
|
60
60
|
*/
|
|
61
61
|
specialItems?: ISpecialHalfHalfItem[];
|
|
62
|
+
/**
|
|
63
|
+
* In special context this REPLACES the half-half's own setup upsell as the
|
|
64
|
+
* item-level price: it is the special's upsell for the half-half option
|
|
65
|
+
* itself (null/undefined → the half-half is free inside the special). The
|
|
66
|
+
* half-half's own `upsell_price` is NEVER used inside a special.
|
|
67
|
+
*/
|
|
68
|
+
specialHalfHalfUpsell?: IPrice | null | undefined;
|
|
62
69
|
}
|
|
63
70
|
/**
|
|
64
71
|
* Converts an IHalfHalfSetup into an IItem so it can flow through the standard
|
|
@@ -440,8 +440,10 @@ function convertHalfHalfToItem(halfhalfSetup, itemsMap, options) {
|
|
|
440
440
|
// so platform availability can be applied by the filter layer downstream.
|
|
441
441
|
excluded_platforms: (0, platform_catalog_1.getExcludedPlatformsFromIncludedPlatforms)(catalogItem.included_platforms),
|
|
442
442
|
// Carry the source item's special hours so the filter layer can apply
|
|
443
|
-
// schedule availability (pure mapping, no resolution here).
|
|
444
|
-
|
|
443
|
+
// schedule availability (pure mapping, no resolution here). Inside a
|
|
444
|
+
// special the segment item's schedule is fully ignored — the special
|
|
445
|
+
// owns availability/pricing.
|
|
446
|
+
item_modifier_option_special_hours: isSpecialContext ? null : catalogItem.item_special_hours,
|
|
445
447
|
price: optionPrice,
|
|
446
448
|
modifiers: segmentItem.modifiers,
|
|
447
449
|
});
|
|
@@ -487,17 +489,26 @@ function convertHalfHalfToItem(halfhalfSetup, itemsMap, options) {
|
|
|
487
489
|
sold_out: halfhalfSetup.sold_out,
|
|
488
490
|
sort_id: 0,
|
|
489
491
|
// half-half-level upsell is added ONCE at item level; segment options
|
|
490
|
-
// carry the per-segment base (+ own item upsell) prices.
|
|
491
|
-
price
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
// carry the per-segment base (+ own item upsell) prices. Inside a special
|
|
493
|
+
// the half-half's own setup upsell is IGNORED — the item price is the
|
|
494
|
+
// special's upsell for the half-half option itself (null = free).
|
|
495
|
+
price: isSpecialContext ? (options?.specialHalfHalfUpsell ?? null) : upsell_price,
|
|
496
|
+
// Inside a special the half-half's own discount does NOT apply — the
|
|
497
|
+
// deal's pricing is the only authority (the special's upsell for the
|
|
498
|
+
// half-half is the item price; standalone keeps the setup discount).
|
|
499
|
+
discount_amount: isSpecialContext ? null : discount_amount,
|
|
500
|
+
is_discount_percentage: isSpecialContext ? false : is_discount_percentage,
|
|
494
501
|
caveats: Array.from(new Set(allCaveats)),
|
|
495
502
|
dietary_preferences: Array.from(new Set(allDietaryPreferences)),
|
|
496
503
|
tax_rate: null,
|
|
497
504
|
keywords: Array.from(new Set(allKeywords)),
|
|
498
505
|
image_url: halfhalfSetup.image_url,
|
|
499
506
|
ingredients: null,
|
|
500
|
-
|
|
507
|
+
// Inside a special the half-half's own schedule is ignored — the deal's
|
|
508
|
+
// schedule governs the half-half option (availability is checked at open
|
|
509
|
+
// via isSetupApplicable). Standalone keeps its schedule for the filter
|
|
510
|
+
// layer.
|
|
511
|
+
item_special_hours: isSpecialContext ? null : halfhalfSetup.item_special_hours,
|
|
501
512
|
modifiers: modifiers.length > 0 ? modifiers : null,
|
|
502
513
|
is_featured: false,
|
|
503
514
|
featured_sort_id: 0,
|
|
@@ -94,5 +94,5 @@ export declare function deStructureSpecialOrderItem(orderItem: IOrderItem, speci
|
|
|
94
94
|
*
|
|
95
95
|
* Returns null only when no option can be resolved from the items map.
|
|
96
96
|
*/
|
|
97
|
-
export declare function convertSpecialToItem(special: ISpecial, itemsMap: Record<string, IItem>, halfhalfSetups
|
|
97
|
+
export declare function convertSpecialToItem(special: ISpecial, itemsMap: Record<string, IItem>, halfhalfSetups: Record<string, IHalfHalfSetup>): IItem | null;
|
|
98
98
|
export {};
|
|
@@ -470,6 +470,9 @@ function convertSpecialToItem(special, itemsMap, halfhalfSetups) {
|
|
|
470
470
|
}
|
|
471
471
|
const halfhalfItem = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(halfhalfSetup, itemsMap, {
|
|
472
472
|
specialItems,
|
|
473
|
+
// The half-half option's own price inside the special is the
|
|
474
|
+
// special's upsell for the half-half (NOT the setup's own).
|
|
475
|
+
specialHalfHalfUpsell: specialItem.upsell_price ?? null,
|
|
473
476
|
});
|
|
474
477
|
if (halfhalfItem != null) {
|
|
475
478
|
catalogItem = halfhalfItem;
|
|
@@ -488,9 +491,20 @@ function convertSpecialToItem(special, itemsMap, halfhalfSetups) {
|
|
|
488
491
|
// (num_free_options in the drawer handles free-vs-paid)
|
|
489
492
|
// no special price → use item's own price
|
|
490
493
|
// upsell_price is always merged on top
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
+
// For a half-half option the converted item's price ALREADY is the
|
|
495
|
+
// special's upsell for the half-half (specialHalfHalfUpsell), so the
|
|
496
|
+
// upsell must not be merged again — a pass-through special (no special
|
|
497
|
+
// price) would otherwise double it. Regular items keep the standard
|
|
498
|
+
// rule: option = (special price ? null : item price) + special upsell.
|
|
499
|
+
let optionPrice;
|
|
500
|
+
if (isHalfHalfOption) {
|
|
501
|
+
optionPrice = special.price != null ? (specialItem.upsell_price ?? null) : catalogItem.price;
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
optionPrice = special.price != null ? null : catalogItem.price;
|
|
505
|
+
if (specialItem.upsell_price != null) {
|
|
506
|
+
optionPrice = (0, platform_num_1.mergePriceObjs)(optionPrice, specialItem.upsell_price);
|
|
507
|
+
}
|
|
494
508
|
}
|
|
495
509
|
// Apply the modifier-special group's ref rules to the source item's own
|
|
496
510
|
// modifiers (excluded_refs removes, exclusive_refs zeroes price).
|
|
@@ -515,8 +529,19 @@ function convertSpecialToItem(special, itemsMap, halfhalfSetups) {
|
|
|
515
529
|
// so platform availability can be applied by the filter layer downstream.
|
|
516
530
|
excluded_platforms: (0, platform_catalog_1.getExcludedPlatformsFromIncludedPlatforms)(catalogItem.included_platforms),
|
|
517
531
|
// Carry the source item's special hours so the filter layer can apply
|
|
518
|
-
// schedule
|
|
519
|
-
|
|
532
|
+
// schedule AVAILABILITY (pure mapping, no resolution here). Item
|
|
533
|
+
// schedule-level PRICING/DISCOUNTS are ignored inside a special: they
|
|
534
|
+
// are stripped here so availability (days/time/date) is honored but
|
|
535
|
+
// the schedule can never re-price the option. `omit_items_schedule`
|
|
536
|
+
// drops the schedule entirely (availability too).
|
|
537
|
+
item_modifier_option_special_hours: modifierSpecial.omit_items_schedule
|
|
538
|
+
? null
|
|
539
|
+
: (catalogItem.item_special_hours ?? []).map((hour) => ({
|
|
540
|
+
...hour,
|
|
541
|
+
price: null,
|
|
542
|
+
discount_amount: null,
|
|
543
|
+
is_discount_percentage: false,
|
|
544
|
+
})),
|
|
520
545
|
price: optionPrice,
|
|
521
546
|
modifiers: itemModifiers,
|
|
522
547
|
});
|
|
@@ -167,6 +167,21 @@ function priceOf(price) {
|
|
|
167
167
|
const base = price.BASE_PRICE ?? 0;
|
|
168
168
|
return base;
|
|
169
169
|
}
|
|
170
|
+
/** Always-applicable schedule (all days, full day) with a distinct price. */
|
|
171
|
+
function makeSchedule(overrides = {}) {
|
|
172
|
+
return {
|
|
173
|
+
days_index: Object.values(constants_1.DAY_INDEX_ENUM),
|
|
174
|
+
disabled_outside_date_range: false,
|
|
175
|
+
start_time: 0,
|
|
176
|
+
end_time: 24 * 3600000,
|
|
177
|
+
start_date: null,
|
|
178
|
+
end_date: null,
|
|
179
|
+
price: { BASE_PRICE: 999 },
|
|
180
|
+
is_discount_percentage: false,
|
|
181
|
+
excluded_platforms: [],
|
|
182
|
+
...overrides,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
170
185
|
// ============================================================================
|
|
171
186
|
// 1) Half/Half ALONE
|
|
172
187
|
// ============================================================================
|
|
@@ -281,14 +296,14 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
281
296
|
cola: makeItem('cola', { price: { BASE_PRICE: 300 } }),
|
|
282
297
|
};
|
|
283
298
|
it('one-price special: options carry ONLY the special item upsell (base free)', () => {
|
|
284
|
-
const item = (0, specials_helpers_1.convertSpecialToItem)(makeSpecial(), itemsMap);
|
|
299
|
+
const item = (0, specials_helpers_1.convertSpecialToItem)(makeSpecial(), itemsMap, {});
|
|
285
300
|
const options = item.modifiers[0].options;
|
|
286
301
|
// milan no upsell -> free; torent +200; catalog price 1000 never used.
|
|
287
302
|
expect(priceOf(options.find((o) => o._id === 'milan').price)).toBeNull();
|
|
288
303
|
expect(priceOf(options.find((o) => o._id === 'torent').price)).toBe(200);
|
|
289
304
|
});
|
|
290
305
|
it('pass-through special (no special price): option = item price + upsell', () => {
|
|
291
|
-
const item = (0, specials_helpers_1.convertSpecialToItem)(makeSpecial({ price: null }), itemsMap);
|
|
306
|
+
const item = (0, specials_helpers_1.convertSpecialToItem)(makeSpecial({ price: null }), itemsMap, {});
|
|
292
307
|
const options = item.modifiers[0].options;
|
|
293
308
|
expect(priceOf(options.find((o) => o._id === 'milan').price)).toBe(1000);
|
|
294
309
|
expect(priceOf(options.find((o) => o._id === 'torent').price)).toBe(1200);
|
|
@@ -311,7 +326,7 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
311
326
|
],
|
|
312
327
|
},
|
|
313
328
|
],
|
|
314
|
-
}), itemsMap);
|
|
329
|
+
}), itemsMap, {});
|
|
315
330
|
const group = item.modifiers[0];
|
|
316
331
|
expect(group.min_num_options).toBe(2);
|
|
317
332
|
expect(group.max_num_options).toBe(2);
|
|
@@ -336,12 +351,12 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
336
351
|
}), [{ item_id: 'milan', sort_id: 1, upsell_price: null }]), {
|
|
337
352
|
...itemsMap,
|
|
338
353
|
milan: makeItem('milan', { modifiers: makePizzaSizeAndExtra() }),
|
|
339
|
-
});
|
|
354
|
+
}, {});
|
|
340
355
|
const milanOption = exclusive.modifiers[0].options[0];
|
|
341
356
|
const size = milanOption.modifiers.find((m) => m._id === 'size-mod');
|
|
342
357
|
expect(priceOf(size.options.find((o) => o._id === 'large-13').price)).toBeNull();
|
|
343
|
-
// Specials-alone
|
|
344
|
-
// small = 500, extra cheese = 200
|
|
358
|
+
// Specials-alone: only the exclusive ref was zeroed — other modifier
|
|
359
|
+
// prices are kept (small = 500, extra cheese = 200).
|
|
345
360
|
expect(priceOf(size.options.find((o) => o._id === 'small-11').price)).toBe(500);
|
|
346
361
|
const extra = milanOption.modifiers.find((m) => m._id === 'extra-mod');
|
|
347
362
|
expect(priceOf(extra.options.find((o) => o._id === 'cheese').price)).toBe(200);
|
|
@@ -363,7 +378,7 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
363
378
|
}), {
|
|
364
379
|
...itemsMap,
|
|
365
380
|
milan: makeItem('milan', { modifiers: makePizzaSizeAndExtra() }),
|
|
366
|
-
});
|
|
381
|
+
}, {});
|
|
367
382
|
const milanOpt = excluded.modifiers[0].options[0];
|
|
368
383
|
expect(milanOpt.modifiers.map((m) => m._id)).toEqual(['size-mod']);
|
|
369
384
|
});
|
|
@@ -383,7 +398,7 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
383
398
|
},
|
|
384
399
|
],
|
|
385
400
|
});
|
|
386
|
-
expect((0, specials_helpers_1.convertSpecialToItem)(special, itemsMap)).toBeNull();
|
|
401
|
+
expect((0, specials_helpers_1.convertSpecialToItem)(special, itemsMap, {})).toBeNull();
|
|
387
402
|
});
|
|
388
403
|
it('modifier-level exclusive_refs zero EVERY option price of that modifier group', () => {
|
|
389
404
|
const special = makeSpecial({
|
|
@@ -404,7 +419,7 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
404
419
|
const item = (0, specials_helpers_1.convertSpecialToItem)(special, {
|
|
405
420
|
...itemsMap,
|
|
406
421
|
milan: makeItem('milan', { modifiers: makePizzaSizeAndExtra() }),
|
|
407
|
-
});
|
|
422
|
+
}, {});
|
|
408
423
|
const milanOption = item.modifiers[0].options[0];
|
|
409
424
|
const size = milanOption.modifiers.find((m) => m._id === 'size-mod');
|
|
410
425
|
// Group-level exclusive: BOTH sizes free; unrelated group unaffected.
|
|
@@ -417,7 +432,7 @@ describe('Specials alone — convertSpecialToItem pricing', () => {
|
|
|
417
432
|
const item = (0, specials_helpers_1.convertSpecialToItem)(modifySpecialItems(makeSpecial({ discount_amount: { BASE_PRICE: 200 }, is_discount_percentage: true }), [
|
|
418
433
|
{ item_id: 'milan', sort_id: 1, upsell_price: null },
|
|
419
434
|
{ item_id: 'torent', sort_id: 2, upsell_price: null },
|
|
420
|
-
]), itemsMap);
|
|
435
|
+
]), itemsMap, {});
|
|
421
436
|
expect(priceOf(item.discount_amount)).toBe(200);
|
|
422
437
|
expect(item.is_discount_percentage).toBe(true);
|
|
423
438
|
const options = item.modifiers[0].options;
|
|
@@ -449,6 +464,17 @@ describe('Specials with Half/Half — convertSpecialToItem special-context prici
|
|
|
449
464
|
expect(hh.ref_type).toBe(constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.HALF_HALF);
|
|
450
465
|
expect(hh.choose_expensive_segment_price).toBe(true);
|
|
451
466
|
});
|
|
467
|
+
it('pass-through special (no special price): half-half option price is not doubled', () => {
|
|
468
|
+
const item = (0, specials_helpers_1.convertSpecialToItem)(modifySpecialItems(makeSpecial({ price: null }), [
|
|
469
|
+
{ item_id: 'milan', sort_id: 1, upsell_price: null },
|
|
470
|
+
{ item_id: 'torent', sort_id: 2, upsell_price: { BASE_PRICE: 200 } },
|
|
471
|
+
{ item_id: 'halfhalf-1', sort_id: 3, upsell_price: { BASE_PRICE: 100 } },
|
|
472
|
+
]), itemsMap, { 'halfhalf-1': makeHalfHalfSetup({ upsell_price: { BASE_PRICE: 300 } }) });
|
|
473
|
+
const hh = item.modifiers[0].options.find((o) => o._id === 'halfhalf-1');
|
|
474
|
+
// Item price already carries the special upsell (100) — must NOT merge it
|
|
475
|
+
// again (would be 200).
|
|
476
|
+
expect(priceOf(hh.price)).toBe(100);
|
|
477
|
+
});
|
|
452
478
|
it('segment options = special upsell / segments; item prices and own upsells ignored', () => {
|
|
453
479
|
const item = (0, specials_helpers_1.convertSpecialToItem)(modifySpecialItems(makeSpecial(), specialItems), itemsMap, {
|
|
454
480
|
'halfhalf-1': makeHalfHalfSetup(),
|
|
@@ -731,6 +757,83 @@ describe('Specials with Half/Half — convertSpecialToItem special-context prici
|
|
|
731
757
|
expect(hhNoFlag.choose_expensive_segment_price).toBeUndefined();
|
|
732
758
|
expect(priceOf(hhNoFlag.modifiers[0].options.find((o) => o._id === 'torent').price)).toBe(100);
|
|
733
759
|
});
|
|
760
|
+
it('special context: half-half item price is the SPECIAL’s upsell, not the setup’s own', () => {
|
|
761
|
+
const localItemsMap = {
|
|
762
|
+
milan: makeItem('milan'),
|
|
763
|
+
torent: makeItem('torent'),
|
|
764
|
+
};
|
|
765
|
+
const specialItems = [
|
|
766
|
+
{ item_id: 'milan', sort_id: 1, upsell_price: null },
|
|
767
|
+
{ item_id: 'torent', sort_id: 2, upsell_price: { BASE_PRICE: 200 } },
|
|
768
|
+
];
|
|
769
|
+
// Setup's OWN upsell (300) and OWN discount (50%) — both must be ignored.
|
|
770
|
+
const noSpecialUpsell = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(makeHalfHalfSetup({
|
|
771
|
+
upsell_price: { BASE_PRICE: 300 },
|
|
772
|
+
discount_amount: { BASE_PRICE: 50 },
|
|
773
|
+
is_discount_percentage: true,
|
|
774
|
+
}), localItemsMap, { specialItems, specialHalfHalfUpsell: null });
|
|
775
|
+
expect(noSpecialUpsell.price).toBeNull();
|
|
776
|
+
// The half-half's own discount does NOT apply inside a special.
|
|
777
|
+
expect(noSpecialUpsell.discount_amount).toBeNull();
|
|
778
|
+
expect(noSpecialUpsell.is_discount_percentage).toBe(false);
|
|
779
|
+
// Segments unaffected (special items still priced by their upsell).
|
|
780
|
+
expect(priceOf(noSpecialUpsell.modifiers[0].options.find((o) => o._id === 'torent').price)).toBe(100);
|
|
781
|
+
// When the special DOES upsell the half-half, that becomes the item price.
|
|
782
|
+
const withSpecialUpsell = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(makeHalfHalfSetup({ upsell_price: { BASE_PRICE: 300 } }), localItemsMap, { specialItems, specialHalfHalfUpsell: { BASE_PRICE: 100 } });
|
|
783
|
+
expect(priceOf(withSpecialUpsell.price)).toBe(100);
|
|
784
|
+
});
|
|
785
|
+
it('special context clears the half-half item & segment schedules; standalone keeps them', () => {
|
|
786
|
+
const localItemsMap = {
|
|
787
|
+
milan: makeItem('milan', { item_special_hours: [makeSchedule()] }),
|
|
788
|
+
torent: makeItem('torent'),
|
|
789
|
+
};
|
|
790
|
+
const setup = makeHalfHalfSetup({ item_special_hours: [makeSchedule()] });
|
|
791
|
+
const specialItems = [{ item_id: 'milan', sort_id: 1, upsell_price: null }];
|
|
792
|
+
// Inside a special: the half-half's own schedule is fully ignored.
|
|
793
|
+
const specialCtx = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(setup, localItemsMap, {
|
|
794
|
+
specialItems,
|
|
795
|
+
specialHalfHalfUpsell: null,
|
|
796
|
+
});
|
|
797
|
+
expect(specialCtx.item_special_hours).toBeNull();
|
|
798
|
+
expect(specialCtx.modifiers[0].options[0].item_modifier_option_special_hours).toBeNull();
|
|
799
|
+
// Standalone: schedules carried for the filter layer.
|
|
800
|
+
const standalone = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(setup, localItemsMap);
|
|
801
|
+
expect(standalone.item_special_hours).toHaveLength(1);
|
|
802
|
+
expect(standalone.modifiers[0].options[0].item_modifier_option_special_hours).toHaveLength(1);
|
|
803
|
+
});
|
|
804
|
+
it('special context clears the half-half item & segment schedules; standalone keeps them', () => {
|
|
805
|
+
const localItemsMap = {
|
|
806
|
+
milan: makeItem('milan', { item_special_hours: [makeSchedule()] }),
|
|
807
|
+
torent: makeItem('torent'),
|
|
808
|
+
};
|
|
809
|
+
const setup = makeHalfHalfSetup({ item_special_hours: [makeSchedule()] });
|
|
810
|
+
const specialItems = [{ item_id: 'milan', sort_id: 1, upsell_price: null }];
|
|
811
|
+
// Inside a special: the half-half's own schedule is fully ignored.
|
|
812
|
+
const specialCtx = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(setup, localItemsMap, {
|
|
813
|
+
specialItems,
|
|
814
|
+
specialHalfHalfUpsell: null,
|
|
815
|
+
});
|
|
816
|
+
expect(specialCtx.item_special_hours).toBeNull();
|
|
817
|
+
expect(specialCtx.modifiers[0].options[0].item_modifier_option_special_hours).toBeNull();
|
|
818
|
+
// Standalone: schedules carried for the filter layer.
|
|
819
|
+
const standalone = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(setup, localItemsMap);
|
|
820
|
+
expect(standalone.item_special_hours).toHaveLength(1);
|
|
821
|
+
expect(standalone.modifiers[0].options[0].item_modifier_option_special_hours).toHaveLength(1);
|
|
822
|
+
});
|
|
823
|
+
it('standalone keeps the half-half setup upsell AND discount (no regression)', () => {
|
|
824
|
+
const localItemsMap = {
|
|
825
|
+
milan: makeItem('milan'),
|
|
826
|
+
torent: makeItem('torent'),
|
|
827
|
+
};
|
|
828
|
+
const item = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(makeHalfHalfSetup({
|
|
829
|
+
upsell_price: { BASE_PRICE: 300 },
|
|
830
|
+
discount_amount: { BASE_PRICE: 50 },
|
|
831
|
+
is_discount_percentage: true,
|
|
832
|
+
}), localItemsMap);
|
|
833
|
+
expect(priceOf(item.price)).toBe(300);
|
|
834
|
+
expect(priceOf(item.discount_amount)).toBe(50);
|
|
835
|
+
expect(item.is_discount_percentage).toBe(true);
|
|
836
|
+
});
|
|
734
837
|
});
|
|
735
838
|
// ============================================================================
|
|
736
839
|
// 4) Engine — choose_expensive_segment_price end-to-end
|