Skip to content

Commit a515e6e

Browse files
authored
fix(promotion): scope uniqueness index to non deleted promotions (#11624)
what: - scopes uniqueness index to only non deleted records - explicit sorting of buy get promotions - This error popped up as we removed the uniqueness constraint which seems to have kept a specific order. RESOLVES #11606
1 parent d2d6a29 commit a515e6e

File tree

5 files changed

+164
-54
lines changed

5 files changed

+164
-54
lines changed

packages/modules/promotion/integration-tests/__tests__/services/promotion-module/compute-actions.spec.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5009,26 +5009,31 @@ moduleIntegrationTestRunner({
50095009
context
50105010
)
50115011

5012-
expect(JSON.parse(JSON.stringify(result))).toEqual([
5013-
{
5014-
action: "addItemAdjustment",
5015-
item_id: "item_cotton_tshirt2",
5016-
amount: 1225,
5017-
code: "BUY50GET1000",
5018-
},
5019-
{
5020-
action: "addItemAdjustment",
5021-
item_id: "item_cotton_tshirt",
5022-
amount: 1275,
5023-
code: "BUY50GET1000",
5024-
},
5025-
{
5026-
action: "addItemAdjustment",
5027-
item_id: "item_cotton_tshirt2",
5028-
amount: 50,
5029-
code: "BUY10GET20",
5030-
},
5031-
])
5012+
const serializedResult = JSON.parse(JSON.stringify(result))
5013+
5014+
expect(serializedResult).toHaveLength(3)
5015+
expect(serializedResult).toEqual(
5016+
expect.arrayContaining([
5017+
{
5018+
action: "addItemAdjustment",
5019+
item_id: "item_cotton_tshirt2",
5020+
amount: 1225,
5021+
code: "BUY50GET1000",
5022+
},
5023+
{
5024+
action: "addItemAdjustment",
5025+
item_id: "item_cotton_tshirt",
5026+
amount: 1275,
5027+
code: "BUY50GET1000",
5028+
},
5029+
{
5030+
action: "addItemAdjustment",
5031+
item_id: "item_cotton_tshirt2",
5032+
amount: 50,
5033+
code: "BUY10GET20",
5034+
},
5035+
])
5036+
)
50325037
})
50335038

50345039
it("should compute adjustment accurately across items", async () => {

0 commit comments

Comments
 (0)