From 26b89400ede4bfacace3e446d0d2cf7e48eb39cf Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Sun, 19 Apr 2026 04:26:01 -0700 Subject: [PATCH] test(canvas): bump billing test for /orgs success_url --- canvas/src/lib/__tests__/billing.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/canvas/src/lib/__tests__/billing.test.ts b/canvas/src/lib/__tests__/billing.test.ts index d4f4cd28..9572296c 100644 --- a/canvas/src/lib/__tests__/billing.test.ts +++ b/canvas/src/lib/__tests__/billing.test.ts @@ -82,7 +82,11 @@ describe("startCheckout", () => { await expect(startCheckout("starter", "acme")).rejects.toThrow(/payment required/); }); - it("uses current pathname for success/cancel URLs", async () => { + it("sends users to /orgs on success, back to current page on cancel", async () => { + // success_url is fixed to /orgs regardless of where checkout was + // initiated — that's the landing page where post-payment status + // transitions are visible. cancel_url preserves the current page + // so users land back on /pricing and can retry. (global.fetch as ReturnType).mockResolvedValue({ ok: true, json: async () => ({ url: "https://checkout.stripe.com/x" }), @@ -91,7 +95,7 @@ describe("startCheckout", () => { const body = JSON.parse( (global.fetch as ReturnType).mock.calls[0][1].body, ); - expect(body.success_url).toBe("http://localhost:3000/pricing?checkout=success"); + expect(body.success_url).toBe("http://localhost:3000/orgs?checkout=success"); expect(body.cancel_url).toBe("http://localhost:3000/pricing?checkout=cancel"); }); });