From 8350fd63dceeecf50b2369ae16ca75034aafe674 Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Mon, 16 Mar 2026 13:06:37 +0530 Subject: [PATCH] fix: test --- .../ee/billing/lib/organization-billing.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/modules/ee/billing/lib/organization-billing.test.ts b/apps/web/modules/ee/billing/lib/organization-billing.test.ts index 98c1cb4c14..ef3fd20d18 100644 --- a/apps/web/modules/ee/billing/lib/organization-billing.test.ts +++ b/apps/web/modules/ee/billing/lib/organization-billing.test.ts @@ -1598,7 +1598,7 @@ describe("organization-billing", () => { expect(mocks.prismaOrganizationFindUnique).not.toHaveBeenCalled(); }); - test("ensureCloudStripeSetupForOrganization creates customer and syncs billing without provisioning hobby", async () => { + test("ensureCloudStripeSetupForOrganization creates customer, provisions hobby subscription, and syncs billing", async () => { mocks.prismaOrganizationFindUnique.mockResolvedValueOnce({ id: "org_1", name: "Org 1", @@ -1630,7 +1630,14 @@ describe("organization-billing", () => { }, { idempotencyKey: "ensure-customer-org_1" } ); - expect(mocks.subscriptionsCreate).not.toHaveBeenCalled(); + expect(mocks.subscriptionsCreate).toHaveBeenCalledWith( + { + customer: "cus_new", + items: [{ price: "price_hobby_monthly", quantity: 1 }], + metadata: { organizationId: "org_1" }, + }, + { idempotencyKey: "ensure-hobby-subscription-org_1-bootstrap" } + ); expect(mocks.prismaOrganizationBillingUpdate).toHaveBeenCalledWith({ where: { organizationId: "org_1" }, data: expect.objectContaining({