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,39 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getTenantSwitchPath } from "./tenant-switch-url";
|
||||
|
||||
const currentTenant = {
|
||||
id: "tenant_123",
|
||||
slug: "acme",
|
||||
};
|
||||
|
||||
describe("getTenantSwitchPath", () => {
|
||||
it("keeps the current child path when switching tenants", () => {
|
||||
expect(
|
||||
getTenantSwitchPath({
|
||||
currentTenant,
|
||||
location: { pathname: "/acme/settings/members" },
|
||||
tenantSlug: "beta",
|
||||
}),
|
||||
).toBe("/beta/settings/members");
|
||||
});
|
||||
|
||||
it("supports legacy app-prefixed tenant paths without preserving the legacy prefix", () => {
|
||||
expect(
|
||||
getTenantSwitchPath({
|
||||
currentTenant,
|
||||
location: { pathname: "/app/acme/entities/rows" },
|
||||
tenantSlug: "beta",
|
||||
}),
|
||||
).toBe("/beta/entities/rows");
|
||||
});
|
||||
|
||||
it("does not carry scope-bearing query or hash state into the next tenant", () => {
|
||||
expect(
|
||||
getTenantSwitchPath({
|
||||
currentTenant,
|
||||
location: { pathname: "/acme/entities/rows", search: "?tenantId=tenant_123", hash: "#row_1" },
|
||||
tenantSlug: "beta",
|
||||
}),
|
||||
).toBe("/beta/entities/rows");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user