18 lines
908 B
TypeScript
18 lines
908 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { subscriptionCheckoutPath, subscriptionRequiredCheckoutPath } from "./SubscriptionUrlUtils";
|
|
|
|
describe("subscription URL helpers", () => {
|
|
it("builds canonical public checkout routes", () => {
|
|
expect(subscriptionCheckoutPath("acme")).toBe("/subscribe/acme");
|
|
expect(subscriptionCheckoutPath("acme", "{CHECKOUT_SESSION_ID}/success")).toBe("/subscribe/acme/{CHECKOUT_SESSION_ID}/success");
|
|
expect(subscriptionRequiredCheckoutPath("acme")).toBe("/acme/settings/billing?subscription_required=1");
|
|
});
|
|
|
|
it("encodes tenant slugs as one route segment", () => {
|
|
expect(subscriptionCheckoutPath(" Acme Team/West ")).toBe("/subscribe/Acme%20Team%2FWest");
|
|
expect(() => subscriptionCheckoutPath(" ")).toThrow("tenantSlug is required");
|
|
expect(() => subscriptionRequiredCheckoutPath(" ")).toThrow("tenantSlug is required");
|
|
});
|
|
});
|