Skip to content

Commit

Permalink
fix: ✅ skip coupon code usage test, if order is not billable
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRill00 committed Aug 7, 2024
1 parent 75710c3 commit 4a9ff10
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/CouponCode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down

0 comments on commit 4a9ff10

Please sign in to comment.