Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,59 @@
import { describe, expect, it, vi } from "vitest";
vi.mock("~/components/brand/Logo", () => ({ default: () => null }));
vi.mock("~/components/core/settings/tenant/TenantNew", () => ({ default: () => null }));
vi.mock("~/modules/users/components/RegisterForm", () => ({ RegisterForm: () => null }));
vi.mock("~/components/ui/buttons/LoadingButton", () => ({ default: () => null }));
vi.mock("~/components/ui/modals/ErrorModal", () => ({ default: () => null }));
vi.mock("~/components/ui/banners/SuccessBanner", () => ({ default: () => null }));
vi.mock("~/components/ui/button", () => ({ Button: ({ children }: { children: React.ReactNode }) => <>{children}</> }));
vi.mock("~/locale/i18next.server", () => ({ getTranslations: vi.fn() }));
vi.mock("~/utils/db/logs.db.server", () => ({ createLog: vi.fn() }));
vi.mock("~/utils/db/permissions/roles.db.server", () => ({ getAllRoles: vi.fn() }));
vi.mock("~/utils/db/tenants.db.server", () => ({ createTenantUser: vi.fn(), getMyTenants: vi.fn(), getTenant: vi.fn() }));
vi.mock("~/utils/db/users.db.server", () => ({ getUser: vi.fn(), getUserByEmail: vi.fn(), register: vi.fn() }));
vi.mock("~/utils/db/entities/entities.db.server", () => ({ findEntityByName: vi.fn() }));
vi.mock("~/utils/api/.server/TenantsApi", () => ({ TenantsApi: { create: vi.fn() } }));
vi.mock("~/utils/session.server", () => ({ createUserSession: vi.fn(), getUserInfo: vi.fn(), setLoggedUser: vi.fn() }));
vi.mock("~/utils/services/.server/pricingService", () => ({
addTenantProductsFromCheckoutSession: vi.fn(),
getAcquiredItemsFromCheckoutSession: vi.fn(),
}));
vi.mock("~/utils/services/.server/subscriptionService", () => ({ persistCheckoutSessionStatus: vi.fn() }));
vi.mock("~/utils/services/authService", () => ({ getRegistrationFormData: vi.fn(), validateRegistration: vi.fn() }));
vi.mock("~/utils/url.server", () => ({ getAbsoluteUrl: vi.fn() }));
vi.mock("~/modules/emails/services/TransactionalEmailQueue.server", () => ({ queueTransactionalEmail: vi.fn() }));
vi.mock("~/modules/emails/utils/EmailTemplates", () => ({ default: { WELCOME_EMAIL: { parse: vi.fn() } } }));
vi.mock("~/modules/events/services/.server/EventsService", () => ({ default: { create: vi.fn() } }));
vi.mock("~/utils/db/appConfiguration.db.server", () => ({ getAppConfiguration: vi.fn() }));
import { invitationCreatedUserDashboardPath } from "./invitation.$id";
import { newAccountDashboardPath } from "./new-account";
function expectHostAwareTenantDashboard(target: string) {
expect(target).toBe("/example-co/dashboard");
expect(target).not.toContain("/app/example-co");
expect(target).not.toContain("/admin/");
}
describe("acquisition completion host-aware redirects", () => {
it("builds new-account dashboard targets without legacy app prefixes", () => {
expectHostAwareTenantDashboard(newAccountDashboardPath("example-co"));
});
it("builds invitation-created-user dashboard targets without legacy app prefixes", () => {
expectHostAwareTenantDashboard(invitationCreatedUserDashboardPath({ id: "tenant_1", slug: "example-co" } as never));
});
it("preserves the tenant picker fallback when invitation acceptance has no tenant", () => {
const target = invitationCreatedUserDashboardPath(null);
expect(target).toBe("/");
expect(target).not.toBe("/app");
});
it("does not fall back to tenant IDs for invitation completion", () => {
const target = invitationCreatedUserDashboardPath({ id: "tenant_1", slug: null } as never);
expect(target).toBe("/");
expect(target).not.toContain("tenant_1");
});
});