fix: test

This commit is contained in:
Dhruwang
2026-03-16 13:06:37 +05:30
parent a2a45c8c23
commit 8350fd63dc

View File

@@ -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({