nexus/ui/src/lib/company-routes.test.ts
dotta 84e35b801c Fix execution workspace company routing
Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 10:55:21 -05:00

23 lines
882 B
TypeScript

import { describe, expect, it } from "vitest";
import {
applyCompanyPrefix,
extractCompanyPrefixFromPath,
isBoardPathWithoutPrefix,
toCompanyRelativePath,
} from "./company-routes";
describe("company routes", () => {
it("treats execution workspace paths as board routes that need a company prefix", () => {
expect(isBoardPathWithoutPrefix("/execution-workspaces/workspace-123")).toBe(true);
expect(extractCompanyPrefixFromPath("/execution-workspaces/workspace-123")).toBeNull();
expect(applyCompanyPrefix("/execution-workspaces/workspace-123", "PAP")).toBe(
"/PAP/execution-workspaces/workspace-123",
);
});
it("normalizes prefixed execution workspace paths back to company-relative paths", () => {
expect(toCompanyRelativePath("/PAP/execution-workspaces/workspace-123")).toBe(
"/execution-workspaces/workspace-123",
);
});
});