Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("~/components/app/AppLayout", () => ({ default: ({ children }: { children: React.ReactNode }) => children }));
|
||||
vi.mock("~/utils/data/useAppData", () => ({ useAppData: vi.fn() }));
|
||||
vi.mock("~/utils/data/.server/appData", () => ({ loadAppData: vi.fn() }));
|
||||
vi.mock("@toolctrl/db/auth-boundary.server", () => ({
|
||||
getAuthUserWithoutPasswordById: vi.fn(),
|
||||
getTenantMembershipByIds: vi.fn(),
|
||||
updateAuthUserDefaultTenantId: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/utils/services/.server/urlService", () => ({ getTenantIdFromUrl: vi.fn() }));
|
||||
vi.mock("~/utils/session.server", () => ({ getUserInfo: vi.fn() }));
|
||||
vi.mock("~/utils/db/appConfiguration.db.server", () => ({ getAppConfiguration: vi.fn() }));
|
||||
vi.mock("~/utils/data/useRootData", () => ({ useRootData: vi.fn() }));
|
||||
vi.mock("~/components/ui/errors/ServerError", () => ({ default: () => null }));
|
||||
vi.mock("~/utils/db/tenants/tenantIpAddress.db.server", () => ({ createUniqueTenantIpAddress: vi.fn() }));
|
||||
vi.mock("~/utils/server/IpUtils", () => ({ getClientIPAddress: vi.fn() }));
|
||||
vi.mock("~/modules/metrics/services/.server/MetricTracker", () => ({ createMetrics: vi.fn() }));
|
||||
vi.mock("~/modules/metrics/utils/defaultHeaders", () => ({ serverTimingHeaders: vi.fn() }));
|
||||
vi.mock("~/locale/i18next.server", () => ({ getTranslations: vi.fn() }));
|
||||
vi.mock("~/modules/helpDesk/services/Feedback.server", () => ({ default: { send: vi.fn() } }));
|
||||
vi.mock("~/stores/themePreviewStore", () => ({ useThemePreviewStore: vi.fn() }));
|
||||
vi.mock("~/utils/theme/ThemeConfig", () => ({ getThemeStyle: vi.fn(), parseThemeConfig: vi.fn() }));
|
||||
|
||||
import { appTenantDeactivatedPath, appTenantPath, appTenantPlanRequiredPath, appTenantSubscriptionRequiredPath, isAppTenantSettingsPath } from "./app.$tenant";
|
||||
|
||||
describe("app tenant route host-aware guards", () => {
|
||||
it("builds subscription-required redirects without legacy app prefixes", () => {
|
||||
const target = appTenantPlanRequiredPath({ tenant: "acme" });
|
||||
|
||||
expect(target).toBe("/plan-required/acme");
|
||||
expect(appTenantSubscriptionRequiredPath({ tenant: "acme" })).toBe("/subscribe/acme?error=subscription_required");
|
||||
expect(target).not.toContain("/app/acme");
|
||||
expect(target).not.toContain("/admin/settings");
|
||||
});
|
||||
|
||||
it("builds deactivated redirects through the named tenant helper", () => {
|
||||
expect(appTenantDeactivatedPath({ tenant: "acme/west" })).toBe("/deactivated/acme%2Fwest");
|
||||
});
|
||||
|
||||
it("recognizes host-aware tenant settings paths without broad route mocks", () => {
|
||||
expect(appTenantPath({ tenant: "acme" }, "settings")).toBe("/acme/settings");
|
||||
expect(isAppTenantSettingsPath("/acme/settings/subscription", { tenant: "acme" })).toBe(true);
|
||||
expect(isAppTenantSettingsPath("/app/acme/settings/subscription", { tenant: "acme" })).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user