@managesome/eposmatic-toolkit 0.2.721 → 0.2.733

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const constants_1 = require("../constants");
4
+ const order_engine_1 = require("../helpers/utils/order-engine");
5
+ // ============================================================================
6
+ // Fixtures
7
+ // ============================================================================
8
+ function makeEngineOption(overrides = {}) {
9
+ return {
10
+ _id: 'opt-1',
11
+ ref: 'opt-1',
12
+ name: 'Option',
13
+ active: true,
14
+ sold_out: [],
15
+ sort_id: 1,
16
+ excluded_platforms: [],
17
+ default: false,
18
+ price: 0,
19
+ quantity: 1,
20
+ modifiers: [],
21
+ is_free: false,
22
+ loyalty_applied: false,
23
+ voucher_applied: false,
24
+ ...overrides,
25
+ };
26
+ }
27
+ function makeEngineModifier(overrides = {}) {
28
+ return {
29
+ _id: 'mod-1',
30
+ ref: 'mod-1',
31
+ name: 'Modifier',
32
+ description: '',
33
+ active: true,
34
+ sold_out: [],
35
+ sort_id: 1,
36
+ min_num_options: 1,
37
+ max_num_options: 1,
38
+ depth: 0,
39
+ default: false,
40
+ options: [],
41
+ ...overrides,
42
+ };
43
+ }
44
+ function makeEngineItem(overrides = {}) {
45
+ return {
46
+ _id: 'item-1',
47
+ category_id: 'cat-1',
48
+ item_id: 'item-ref-1',
49
+ menu_id: 'menu-1',
50
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF,
51
+ name: 'Item',
52
+ description: '',
53
+ loyalty_applied: false,
54
+ voucher_applied: false,
55
+ price: 0,
56
+ gross_total: 0,
57
+ subtotal: 0,
58
+ tax_rate: 0,
59
+ quantity: 1,
60
+ image_url: '',
61
+ special_instructions: '',
62
+ item_discount_details: null,
63
+ modifiers: [],
64
+ ...overrides,
65
+ };
66
+ }
67
+ function makeOrderItem(itemId) {
68
+ return {
69
+ _id: `order-${itemId}`,
70
+ item_id: itemId,
71
+ menu_id: null,
72
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF,
73
+ name: itemId,
74
+ price: 0,
75
+ subtotal: 0,
76
+ tax_rate: 0,
77
+ quantity: 1,
78
+ _net_amount: 0,
79
+ _gross_amount: 0,
80
+ _gst_amount: 0,
81
+ _discount_amount: 0,
82
+ special_instructions: '',
83
+ item_discount_details: null,
84
+ modifiers: null,
85
+ };
86
+ }
87
+ /** Classic segment group: one group per half, offering roma/milano. */
88
+ function makeSegment(segmentId, selection) {
89
+ return makeEngineModifier({
90
+ _id: segmentId,
91
+ name: segmentId,
92
+ depth: 0,
93
+ default: selection != null,
94
+ options: ['roma', 'milano'].map((optionId) => makeEngineOption({ _id: optionId, ref: optionId, default: selection === optionId })),
95
+ });
96
+ }
97
+ const makeClassicHalfHalf = (selections) => makeEngineItem({
98
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF,
99
+ modifiers: selections.map((selection, index) => makeSegment(`seg-${index + 1}`, selection)),
100
+ });
101
+ // ============================================================================
102
+ // getHalfHalfBlockedItemIds — modern selection list
103
+ // ============================================================================
104
+ describe('getHalfHalfBlockedItemIds (a same item can never make ALL sides)', () => {
105
+ it('2 segments: an item picked for one half is blocked for the other', () => {
106
+ const selections = [makeOrderItem('roma'), null];
107
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(selections, 1)).toEqual(['roma']);
108
+ // The half that already holds roma can re-pick it (no-op / re-customize).
109
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(selections, 0)).toEqual([]);
110
+ });
111
+ it('4 segments: an item may fill 3 halves but not the 4th', () => {
112
+ const threeSame = [makeOrderItem('roma'), makeOrderItem('roma'), makeOrderItem('roma'), null];
113
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(threeSame, 3)).toEqual(['roma']);
114
+ // With only two halves taken, both remaining segments may still pick it.
115
+ const twoSame = [makeOrderItem('roma'), makeOrderItem('roma'), null, null];
116
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(twoSame, 2)).toEqual([]);
117
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(twoSame, 3)).toEqual([]);
118
+ });
119
+ it('editing a segment: the item on the other half is blocked, own item is not', () => {
120
+ const selections = [makeOrderItem('roma'), makeOrderItem('milano')];
121
+ // Editing segment 1 (milano): roma would occupy both halves -> blocked.
122
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(selections, 1)).toEqual(['roma']);
123
+ // Editing segment 0 (roma): milano is the other half -> blocked.
124
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)(selections, 0)).toEqual(['milano']);
125
+ });
126
+ it('no target segment or a single segment blocks nothing', () => {
127
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)([makeOrderItem('roma'), null], null)).toEqual([]);
128
+ expect((0, order_engine_1.getHalfHalfBlockedItemIds)([makeOrderItem('roma')], 0)).toEqual([]);
129
+ });
130
+ });
131
+ // ============================================================================
132
+ // getBlockedHalfHalfOptionPaths — classic drawer (engine tree)
133
+ // ============================================================================
134
+ describe('getBlockedHalfHalfOptionPaths (classic drawer)', () => {
135
+ it('2 segments: the picked item is blocked in the OTHER segment, not its own', () => {
136
+ const blocked = (0, order_engine_1.getBlockedHalfHalfOptionPaths)(makeClassicHalfHalf(['roma', null]));
137
+ expect(blocked.has('seg-2_roma')).toBe(true);
138
+ expect(blocked.has('seg-1_roma')).toBe(false);
139
+ expect(blocked.has('seg-2_milano')).toBe(false);
140
+ expect(blocked.has('seg-1_milano')).toBe(false);
141
+ });
142
+ it('4 segments: blocked only when the pick would complete all sides', () => {
143
+ const threeSame = (0, order_engine_1.getBlockedHalfHalfOptionPaths)(makeClassicHalfHalf(['roma', 'roma', 'roma', null]));
144
+ expect(threeSame.has('seg-4_roma')).toBe(true);
145
+ // The segment that already holds roma can re-pick it.
146
+ expect(threeSame.has('seg-3_roma')).toBe(false);
147
+ const twoSame = (0, order_engine_1.getBlockedHalfHalfOptionPaths)(makeClassicHalfHalf(['roma', 'roma', null, null]));
148
+ expect(twoSame.has('seg-3_roma')).toBe(false);
149
+ expect(twoSame.has('seg-4_roma')).toBe(false);
150
+ });
151
+ it('a single half-half SEGMENT item is never treated as segments', () => {
152
+ // Segment items carry their own option groups (e.g. two size groups sharing
153
+ // the same option id); with the flag they are never blocked.
154
+ const segmentItem = makeEngineItem({
155
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF,
156
+ modifiers: [
157
+ makeEngineModifier({
158
+ _id: 'size-1',
159
+ depth: 0,
160
+ default: true,
161
+ options: [makeEngineOption({ _id: 'l13', default: true })],
162
+ }),
163
+ makeEngineModifier({
164
+ _id: 'size-2',
165
+ depth: 0,
166
+ default: true,
167
+ options: [makeEngineOption({ _id: 'l13', default: true })],
168
+ }),
169
+ ],
170
+ });
171
+ expect((0, order_engine_1.getBlockedHalfHalfOptionPaths)(segmentItem).has('size-2_l13')).toBe(true);
172
+ expect((0, order_engine_1.getBlockedHalfHalfOptionPaths)(segmentItem, true).size).toBe(0);
173
+ });
174
+ it('nested flagged half-half in a special: paths carry the full prefix; unflagged options are ignored', () => {
175
+ const makeNestedHalfHalf = (optionId, flagged, selection) => makeEngineOption({
176
+ _id: optionId,
177
+ ref: optionId,
178
+ ref_type: constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.HALF_HALF,
179
+ choose_expensive_segment_price: flagged,
180
+ default: true,
181
+ modifiers: [makeSegment('seg-1', selection), makeSegment('seg-2', null)],
182
+ });
183
+ const item = makeEngineItem({
184
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.SPECIAL,
185
+ modifiers: [
186
+ makeEngineModifier({
187
+ _id: 'mod-pizza',
188
+ depth: 0,
189
+ default: true,
190
+ options: [makeNestedHalfHalf('hh-flag', true, 'roma'), makeNestedHalfHalf('hh-no-flag', false, 'roma')],
191
+ }),
192
+ ],
193
+ });
194
+ const blocked = (0, order_engine_1.getBlockedHalfHalfOptionPaths)(item);
195
+ expect(blocked.has('mod-pizza_hh-flag_seg-2_roma')).toBe(true);
196
+ expect(blocked.has('mod-pizza_hh-flag_seg-1_roma')).toBe(false);
197
+ // Un-flagged nested half-half: untouched.
198
+ expect(blocked.has('mod-pizza_hh-no-flag_seg-2_roma')).toBe(false);
199
+ });
200
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const constants_1 = require("../constants");
4
+ const order_engine_1 = require("../helpers/utils/order-engine");
5
+ function makeEngineOption(overrides = {}) {
6
+ return {
7
+ _id: 'opt-1',
8
+ ref: 'opt-1',
9
+ name: 'Option',
10
+ active: true,
11
+ sold_out: [],
12
+ sort_id: 1,
13
+ excluded_platforms: [],
14
+ default: false,
15
+ price: 0,
16
+ quantity: 1,
17
+ modifiers: [],
18
+ is_free: false,
19
+ loyalty_applied: false,
20
+ voucher_applied: false,
21
+ ...overrides,
22
+ };
23
+ }
24
+ function makeEngineModifier(overrides = {}) {
25
+ return {
26
+ _id: 'mod-1',
27
+ ref: 'mod-1',
28
+ name: 'Modifier',
29
+ description: '',
30
+ active: true,
31
+ sold_out: [],
32
+ sort_id: 1,
33
+ min_num_options: 1,
34
+ max_num_options: 1,
35
+ depth: 0,
36
+ default: false,
37
+ options: [],
38
+ ...overrides,
39
+ };
40
+ }
41
+ function makeEngineItem(overrides = {}) {
42
+ return {
43
+ _id: 'item-1',
44
+ category_id: 'cat-1',
45
+ item_id: 'item-ref-1',
46
+ menu_id: 'menu-1',
47
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.ITEM,
48
+ name: 'Item',
49
+ description: '',
50
+ loyalty_applied: false,
51
+ voucher_applied: false,
52
+ price: 0,
53
+ gross_total: 0,
54
+ subtotal: 0,
55
+ tax_rate: 0,
56
+ quantity: 1,
57
+ image_url: '',
58
+ special_instructions: '',
59
+ item_discount_details: null,
60
+ modifiers: [],
61
+ ...overrides,
62
+ };
63
+ }
64
+ /**
65
+ * A half-half SEGMENT item like ROMA/MILANO in the modern flow: the item price
66
+ * is 0 and the price lives on a single-option required "Pizza Size" group.
67
+ */
68
+ function makeSegmentItem(sizePrice) {
69
+ return makeEngineItem({
70
+ item_type: constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF,
71
+ modifiers: [
72
+ makeEngineModifier({
73
+ _id: 'mod-size',
74
+ options: [makeEngineOption({ _id: 'size-l', ref: 'size-l', price: sizePrice, default: true })],
75
+ }),
76
+ ],
77
+ });
78
+ }
79
+ describe('getOrderEngineOptionSegmentValue', () => {
80
+ it('sums the option price and its required (price-defining) option prices', () => {
81
+ const option = makeEngineOption({
82
+ price: 100,
83
+ modifiers: [
84
+ makeEngineModifier({
85
+ options: [makeEngineOption({ _id: 'leaf', price: 475, default: true })],
86
+ }),
87
+ ],
88
+ });
89
+ expect((0, order_engine_1.getOrderEngineOptionSegmentValue)(option)).toBe(575);
90
+ });
91
+ it('ignores optional (non price-defining) modifier groups', () => {
92
+ const option = makeEngineOption({
93
+ price: 100,
94
+ modifiers: [
95
+ makeEngineModifier({
96
+ _id: 'req',
97
+ options: [makeEngineOption({ _id: 'leaf', price: 400 })],
98
+ }),
99
+ makeEngineModifier({
100
+ _id: 'opt',
101
+ min_num_options: 0,
102
+ max_num_options: 0,
103
+ options: [makeEngineOption({ _id: 'extra', price: 300, default: true })],
104
+ }),
105
+ ],
106
+ });
107
+ expect((0, order_engine_1.getOrderEngineOptionSegmentValue)(option)).toBe(500);
108
+ });
109
+ });
110
+ describe('applySegmentPriceFloor (half-half segment drawers)', () => {
111
+ it('raises the first priced required leaf to the floor (Milano 500 -> Roma 575)', () => {
112
+ const milano = makeSegmentItem(500);
113
+ const romaValue = (0, order_engine_1.getOrderEngineOptionSegmentValue)(makeSegmentItem(575).modifiers[0].options[0]);
114
+ const levelled = (0, order_engine_1.applySegmentPriceFloor)(milano, romaValue);
115
+ expect(levelled.modifiers[0].options[0].price).toBe(575);
116
+ expect((0, order_engine_1.getOrderEngineOptionSegmentValue)(levelled.modifiers[0].options[0])).toBe(575);
117
+ });
118
+ it('keeps the item unchanged when its value is at or above the floor', () => {
119
+ const roma = makeSegmentItem(575);
120
+ expect((0, order_engine_1.applySegmentPriceFloor)(roma, 575)).toBe(roma);
121
+ expect((0, order_engine_1.applySegmentPriceFloor)(roma, 500)).toBe(roma);
122
+ });
123
+ it('is a no-op without a floor', () => {
124
+ const item = makeSegmentItem(500);
125
+ expect((0, order_engine_1.applySegmentPriceFloor)(item, 0)).toBe(item);
126
+ });
127
+ it('raises the item price when the item itself carries the price', () => {
128
+ const item = makeEngineItem({ price: 400 });
129
+ const levelled = (0, order_engine_1.applySegmentPriceFloor)(item, 575);
130
+ expect(levelled.price).toBe(575);
131
+ });
132
+ it('falls back to the item price when no priced required leaf exists', () => {
133
+ const item = makeEngineItem({
134
+ modifiers: [
135
+ makeEngineModifier({
136
+ options: [makeEngineOption({ _id: 'free', price: 0, default: true })],
137
+ }),
138
+ ],
139
+ });
140
+ const levelled = (0, order_engine_1.applySegmentPriceFloor)(item, 575);
141
+ expect(levelled.price).toBe(575);
142
+ });
143
+ });
@@ -867,30 +867,42 @@ describe('choose_expensive_segment_price end-to-end (specials with half-half)',
867
867
  return hh.modifiers.map((seg) => seg.options.map((o) => ({ id: o._id, price: o.price, default: o.default })));
868
868
  }
869
869
  it('basic + premium selection levels the cheap half to the premium one (special-derived prices)', () => {
870
- let engine = buildEngine();
871
- // Real UI flow: selection happens through the special's engine item, so
872
- // the identifier is the FULL path (group -> half-half option -> segment
873
- // -> option) and setCheckField auto-normalizes via its SPECIAL branch.
874
- engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_halfhalf-1_seg-1_milan', true, false);
870
+ const state = buildState();
871
+ const normalize = (engine) => (0, order_engine_1.applyNestedChooseExpensiveSegmentPrice)(engine, {
872
+ originalPriceReferences: state.originalPriceReferences,
873
+ });
874
+ // Real UI flow: the selection goes through the special's engine item (the
875
+ // identifier is the FULL path: group -> half-half option -> segment ->
876
+ // option) and the drawer normalizes right after it.
877
+ let engine = normalize((0, order_engine_1.setCheckFieldInOrderEngineItem)(state.workingData, 'mod-pizza_halfhalf-1_seg-1_milan', true, false));
875
878
  // Only the cheap half is picked so far — it IS the most expensive selected
876
- // half, so nothing is raised yet.
879
+ // half, so nothing is levelled yet.
877
880
  expect(segmentOptions(engine)[0].find((o) => o.id === 'milan').price).toBe(0);
878
881
  // Picking the premium half (100) makes it drive the rule: every cheaper
879
882
  // option — selected or not — is levelled to it, so the drawer can show
880
883
  // what picking it would cost. NO 575 from Pizza Size anywhere.
881
- engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_halfhalf-1_seg-2_torent', true, false);
884
+ engine = normalize((0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_halfhalf-1_seg-2_torent', true, false));
882
885
  const after = segmentOptions(engine);
883
886
  expect(after[0].find((o) => o.id === 'milan').price).toBe(100);
884
887
  expect(after[1].find((o) => o.id === 'torent').price).toBe(100);
885
- expect(after.flat().every((o) => o.price === 100)).toBe(true);
888
+ // SEG-1's alternatives SWITCH to the other segment's level (SEG-2 still
889
+ // holds the premium pick), so they show the same 100.
890
+ expect(after[0].find((o) => o.id === 'torent').price).toBe(100);
891
+ // SEG-2's alternatives REPLACE its own premium pick when chosen (cheap
892
+ // pair = no level), so MILAN stays at its own price there.
893
+ expect(after[1].find((o) => o.id === 'milan').price).toBe(0);
886
894
  });
887
895
  it('is idempotent (re-applying never lowers or changes prices)', () => {
888
- let engine = buildEngine();
889
- engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_halfhalf-1_seg-1_milan', true, false);
896
+ const state = buildState();
897
+ let engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(state.workingData, 'mod-pizza_halfhalf-1_seg-1_milan', true, false);
890
898
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_halfhalf-1_seg-2_torent', true, false);
891
- const once = segmentOptions(engine);
892
- const twice = segmentOptions((0, order_engine_1.applyNestedChooseExpensiveSegmentPrice)(engine));
893
- expect(twice).toEqual(once);
899
+ const once = (0, order_engine_1.applyNestedChooseExpensiveSegmentPrice)(engine, {
900
+ originalPriceReferences: state.originalPriceReferences,
901
+ });
902
+ const twice = (0, order_engine_1.applyNestedChooseExpensiveSegmentPrice)(once, {
903
+ originalPriceReferences: state.originalPriceReferences,
904
+ });
905
+ expect(segmentOptions(twice)).toEqual(segmentOptions(once));
894
906
  });
895
907
  it('does nothing when the half-half flag is off', () => {
896
908
  const item = (0, specials_helpers_1.convertSpecialToItem)(modifySpecialItems(makeSpecial(), specialItems), { milan: makeItem('milan'), torent: makeItem('torent') }, { 'halfhalf-1': makeHalfHalfSetup({ choose_expensive_segment_price: false }) });
@@ -942,7 +954,7 @@ describe('choose_expensive_segment_price end-to-end (specials with half-half)',
942
954
  'hh-flag': makeHalfHalfSetup({ _id: 'hh-flag' }),
943
955
  'hh-no-flag': makeHalfHalfSetup({ _id: 'hh-no-flag', choose_expensive_segment_price: false }),
944
956
  });
945
- let engine = (0, order_engine_1.convertCatalogItemToOrderEngineItem)({
957
+ const state = (0, order_engine_1.convertCatalogItemToOrderEngineItem)({
946
958
  item,
947
959
  orderItem: undefined,
948
960
  platform: PLATFORM,
@@ -950,11 +962,15 @@ describe('choose_expensive_segment_price end-to-end (specials with half-half)',
950
962
  orderItemType: constants_1.ORDER_ITEM_TYPE_ENUM.SPECIAL,
951
963
  defaultMenuId: null,
952
964
  soldoutModifiers: [],
953
- }).workingData;
965
+ });
966
+ let engine = state.workingData;
954
967
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_hh-flag_seg-1_milan', true, false);
955
968
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_hh-flag_seg-2_torent', true, false);
956
969
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_hh-no-flag_seg-1_milan', true, false);
957
970
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'mod-pizza_hh-no-flag_seg-2_torent', true, false);
971
+ engine = (0, order_engine_1.applyNestedChooseExpensiveSegmentPrice)(engine, {
972
+ originalPriceReferences: state.originalPriceReferences,
973
+ });
958
974
  const hhFlag = engine.modifiers[0].options.find((o) => o._id === 'hh-flag');
959
975
  const hhNoFlag = engine.modifiers[0].options.find((o) => o._id === 'hh-no-flag');
960
976
  // Flagged: the cheap half is levelled to the selected expensive half;
@@ -1037,7 +1053,7 @@ describe('choose_expensive_segment_price — option price references (classic fl
1037
1053
  // Expensive options keep their own (higher) price.
1038
1054
  expect(priceAt(result, 'seg-1', 'c')).toBe(600);
1039
1055
  });
1040
- it('B+C charges 6+6 and levels the cheaper options before they are picked', () => {
1056
+ it('B+C charges 6+6 and every segment previews its OWN switch level (max with the OTHER segment)', () => {
1041
1057
  const { originalPriceReferences, workingData } = buildState();
1042
1058
  let engine = workingData;
1043
1059
  engine = (0, order_engine_1.setCheckFieldInOrderEngineItem)(engine, 'seg-1_b', true);
@@ -1046,10 +1062,15 @@ describe('choose_expensive_segment_price — option price references (classic fl
1046
1062
  // Selected: B levelled 500 -> 600, C stays 600.
1047
1063
  expect(priceAt(result, 'seg-1', 'b')).toBe(600);
1048
1064
  expect(priceAt(result, 'seg-2', 'c')).toBe(600);
1049
- // Unselected cheap options SHOW what picking them would cost.
1065
+ // SEG-1's alternatives SWITCH to the other segment's level: with C (600)
1066
+ // still picked, choosing any of them keeps the pair at 6+6.
1050
1067
  expect(priceAt(result, 'seg-1', 'a')).toBe(600);
1051
- expect(priceAt(result, 'seg-2', 'a')).toBe(600);
1052
- expect(priceAt(result, 'seg-2', 'b')).toBe(600);
1068
+ // SEG-2's alternatives REPLACE its own pick (C), so their preview is
1069
+ // max(own 500, the OTHER segment's pick B = 500) = 500 — picking one
1070
+ // makes the pair 5+5.
1071
+ expect(priceAt(result, 'seg-2', 'a')).toBe(500);
1072
+ expect(priceAt(result, 'seg-2', 'b')).toBe(500);
1073
+ expect(priceAt(result, 'seg-2', 'd')).toBe(600); // own (higher)
1053
1074
  });
1054
1075
  it('switching B+C -> A+B on the SAME (already levelled) item lowers again', () => {
1055
1076
  const { originalPriceReferences, workingData } = buildState();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.721",
3
+ "version": "0.2.733",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",