Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
test(web): add organization Pro seat capacity and provider tests
Richie McIlroyc1ce459bf299
diff --git a/apps/web/__tests__/unit/organization-seats.test.ts b/apps/web/__tests__/unit/organization-seats.test.tsindex e6e67e2c1..128ca1e1e 100644--- a/apps/web/__tests__/unit/organization-seats.test.ts+++ b/apps/web/__tests__/unit/organization-seats.test.ts@@ -1,5 +1,30 @@import { describe, expect, it } from "vitest";-import { selectProSeatProvider } from "@/utils/organization";+import { calculateProSeats, selectProSeatProvider } from "@/utils/organization";++process.env.NEXT_PUBLIC_IS_CAP = "true";+process.env.NEXT_PUBLIC_WEB_URL = "http://localhost:3000";++describe("organization Pro seat capacity", () => {+ it("counts an entitled owner even when the membership flag is false", () => {+ expect(+ calculateProSeats({+ inviteQuota: 1,+ ownerId: "owner",+ ownerIsPro: true,+ members: [+ {+ id: "owner-membership",+ userId: "owner",+ hasProSeat: false,+ },+ ],+ }),+ ).toMatchObject({+ proSeatsUsed: 1,+ proSeatsRemaining: 0,+ });+ });+});describe("organization Pro seat provider selection", () => {it("uses an admin's larger active subscription when they manage Pro seats", () => {@@ -70,4 +95,27 @@ describe("organization Pro seat provider selection", () => {})?.id,).toBe("owner");});++ it("does not expose seats without an active subscription", () => {+ const owner = {+ id: "owner",+ inviteQuota: 1,+ stripeSubscriptionId: null,+ stripeSubscriptionStatus: null,+ };+ const actor = {+ id: "admin",+ inviteQuota: 1,+ stripeSubscriptionId: null,+ stripeSubscriptionStatus: null,+ };++ expect(+ selectProSeatProvider({+ actor,+ owner,+ actorCanManageProSeats: true,+ }),+ ).toBeNull();+ });});