Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

test(billing): separate act from assert in entitlement tests

Andrej Acevski1b5438a39d6f
diff --git a/tests/api/billing/entitlement.test.ts b/tests/api/billing/entitlement.test.ts
index ee324231f..bd44dbfe3 100644
--- a/tests/api/billing/entitlement.test.ts
+++ b/tests/api/billing/entitlement.test.ts
@@ -92,24 +92,32 @@ describe("computeEntitlement", () => {
it("keeps a canceled subscription entitled until its paid period ends", () => {
const currentPeriodEnd = new Date(Date.now() + 60_000);
- expect(
- computeEntitlement(billing({ status: "canceled", currentPeriodEnd })),
- ).toEqual({ active: true, reason: "paid_period" });
+
+ const result = computeEntitlement(
+ billing({ status: "canceled", currentPeriodEnd }),
+ );
+
+ expect(result).toEqual({ active: true, reason: "paid_period" });
});
it("denies a canceled subscription once the paid period has passed", () => {
const currentPeriodEnd = new Date(Date.now() - 60_000);
- expect(
- computeEntitlement(billing({ status: "canceled", currentPeriodEnd })),
- ).toEqual({ active: false, reason: "expired" });
+
+ const result = computeEntitlement(
+ billing({ status: "canceled", currentPeriodEnd }),
+ );
+
+ expect(result).toEqual({ active: false, reason: "expired" });
});
it("does not extend the paid period to expired subscriptions", () => {
const currentPeriodEnd = new Date(Date.now() + 60_000);
- expect(
- computeEntitlement(billing({ status: "expired", currentPeriodEnd }))
- .active,
- ).toBe(false);
+
+ const result = computeEntitlement(
+ billing({ status: "expired", currentPeriodEnd }),
+ );
+
+ expect(result.active).toBe(false);
});
it("keeps a canceled subscription entitled even after its trial expired", () => {