// @vitest-environment node import { describe, expect, test } from "vitest"; import { readRepoFile } from "~/utils/testing/repoPaths"; describe("loadAppData tenant role lookup", () => { test("calls getTenantUserType with user id before tenant id", () => { const source = readRepoFile("apps/web/app/utils/data/.server/appData.ts"); expect(source).toContain("getTenantUserType(userInfo.userId, tenantId)"); expect(source).not.toContain("getTenantUserType(tenantId, userInfo.userId)"); }); test("builds the shell billing banner from normalized subscription data", () => { const source = readRepoFile("apps/web/app/utils/data/.server/appData.ts"); expect(source).toContain("billingBanner = buildSubscriptionBannerVM({"); expect(source).toContain("status: normalizeBillingSubscriptionStatus(mySubscription?.status"); expect(source).toContain("frozenAt: mySubscription?.frozenAt"); expect(source).toContain("cancelledAt: mySubscription?.cancelledAt"); expect(source).toContain("trialEndsAt: mySubscription?.trialEndsAt"); expect(source).toContain("billingBanner,"); }); });