Format customer rule tests
This commit is contained in:
@@ -489,7 +489,10 @@ test("desktop remains fail-closed when an active product rule has a malformed re
|
||||
|
||||
await page.getByTestId("pos-product-card-53").first().click();
|
||||
await expect(page.getByTestId("pos-add-to-cart-53").first()).toBeDisabled();
|
||||
await page.getByTestId("pos-add-to-cart-53").first().evaluate((button) => button.click());
|
||||
await page
|
||||
.getByTestId("pos-add-to-cart-53")
|
||||
.first()
|
||||
.evaluate((button) => button.click());
|
||||
expect(orderItemPosts).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -71,14 +71,21 @@ describe("customer product rules", () => {
|
||||
});
|
||||
|
||||
it("validates the structured exact-product contract for every active product-impact rule", () => {
|
||||
expect(hasValidCustomerProductRestrictionContract([
|
||||
attribute("restrictSpotFree", [23], [{ id: 7, name: "Rinses", product_ids: [23] }]),
|
||||
{ attribute: "requiresReferenceNumber", product_restriction: null },
|
||||
])).toBe(true);
|
||||
expect(
|
||||
hasValidCustomerProductRestrictionContract([
|
||||
attribute("restrictSpotFree", [23], [{ id: 7, name: "Rinses", product_ids: [23] }]),
|
||||
{ attribute: "requiresReferenceNumber", product_restriction: null },
|
||||
])
|
||||
).toBe(true);
|
||||
expect(hasValidCustomerProductRestrictionContract([{ attribute: "restrictSpotFree" }])).toBe(false);
|
||||
expect(hasValidCustomerProductRestrictionContract([
|
||||
{ attribute: "restrictSpotFree", product_restriction: { version: 1, collections: [], disabled_product_ids: null } },
|
||||
])).toBe(false);
|
||||
expect(
|
||||
hasValidCustomerProductRestrictionContract([
|
||||
{
|
||||
attribute: "restrictSpotFree",
|
||||
product_restriction: { version: 1, collections: [], disabled_product_ids: null },
|
||||
},
|
||||
])
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("normalizes top-level and nested restriction response variants", () => {
|
||||
|
||||
Reference in New Issue
Block a user