feat(pricing,types,utils): Move calculate pricing query to a repository + rule type validation (#5294)
This commit is contained in:
+2
-2
@@ -343,7 +343,7 @@ describe("PricingModule Service - Calculate Price", () => {
|
||||
)
|
||||
|
||||
expect(result).rejects.toThrow(
|
||||
"currency_code is a required input in the pricing context"
|
||||
"Method calculatePrices requires currency_code in the pricing context"
|
||||
)
|
||||
|
||||
result = service.calculatePrices(
|
||||
@@ -352,7 +352,7 @@ describe("PricingModule Service - Calculate Price", () => {
|
||||
)
|
||||
|
||||
expect(result).rejects.toThrow(
|
||||
"currency_code is a required input in the pricing context"
|
||||
"Method calculatePrices requires currency_code in the pricing context"
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -251,5 +251,24 @@ describe("RuleType Service", () => {
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should throw an error when using one of the reserved keywords", async () => {
|
||||
let error
|
||||
|
||||
try {
|
||||
await service.create([
|
||||
{
|
||||
name: "Test Rule",
|
||||
rule_attribute: "currency_code",
|
||||
},
|
||||
])
|
||||
} catch (e) {
|
||||
error = e
|
||||
}
|
||||
|
||||
expect(error.message).toEqual(
|
||||
"Can't create rule_attribute with reserved keywords [quantity, currency_code, price_list_id] - currency_code"
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user