Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/utils/app/CanonicalUrlUtils.test.ts
T
2026-07-08 16:15:37 +02:00

22 lines
1.5 KiB
TypeScript

import { describe, expect, test } from "vitest";
import packageCanonicalUrlUtils, { adminPath as packageAdminPath, appPath as packageAppPath } from "@hivegrid/url";
import CanonicalUrlUtils, { adminPath, apiPath, appPath, appUrl, type AppPathOptions } from "./CanonicalUrlUtils";
describe("CanonicalUrlUtils compatibility shim", () => {
test("re-exports named helpers from @hivegrid/url", () => {
const appOptions: AppPathOptions = { tenantSlug: "acme/team", path: "/settings?tab=billing#plan", mode: "host-aware" };
expect(appPath(appOptions)).toBe(packageAppPath(appOptions));
expect(adminPath("/users", { mode: "host-aware" })).toBe(packageAdminPath("/users", { mode: "host-aware" }));
expect(apiPath("events", { mode: "host-aware", version: "v1" })).toBe(packageCanonicalUrlUtils.apiPath("events", { mode: "host-aware", version: "v1" }));
expect(appUrl({ rootDomain: "localhost:3000", protocol: "http", appSubdomain: "app", tenantSlug: "acme", path: "dashboard", mode: "host-aware" })).toBe(
packageCanonicalUrlUtils.appUrl({ rootDomain: "localhost:3000", protocol: "http", appSubdomain: "app", tenantSlug: "acme", path: "dashboard", mode: "host-aware" })
);
});
test("preserves the default export object for existing app imports", () => {
expect(CanonicalUrlUtils).toBe(packageCanonicalUrlUtils);
expect(CanonicalUrlUtils.appPath({ tenantSlug: "acme", path: "dashboard" })).toBe(packageCanonicalUrlUtils.appPath({ tenantSlug: "acme", path: "dashboard" }));
});
});