From 4a9ff103fd166af87c7010ab585f5c91af9b79cb Mon Sep 17 00:00:00 2001 From: Paul Rill Date: Wed, 7 Aug 2024 12:33:56 +0200 Subject: [PATCH] fix: :white_check_mark: skip coupon code usage test, if order is not billable --- test/CouponCode.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/CouponCode.spec.ts b/test/CouponCode.spec.ts index 18b46ce..ecca4d4 100644 --- a/test/CouponCode.spec.ts +++ b/test/CouponCode.spec.ts @@ -54,6 +54,11 @@ describe("refresh", function () { // arrange const order = await useCoupon(); + if (order.isBillable === false) { + console.warn("Order is not billable, and thus won't use a coupon code"); + return; + } + // act await couponCode.refresh(); @@ -78,10 +83,13 @@ describe("getOrder", function () { const preOrder = await useCoupon(); const orderId = preOrder.id; - while (couponCode.orderId === null) { - await couponCode.refresh(); + if (preOrder.isBillable === false) { + console.warn("Order is not billable, and thus won't use a coupon code"); + return; } + await couponCode.refresh(); + // act const order = await couponCode.getOrder();