2026-03-28 11:53:31 -05:00
|
|
|
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);
|
2026-05-01 11:58:15 -05:00
|
|
|
expect(isBoardPathWithoutPrefix("/execution-workspaces/workspace-123/routines")).toBe(true);
|
2026-03-28 11:53:31 -05:00
|
|
|
expect(extractCompanyPrefixFromPath("/execution-workspaces/workspace-123")).toBeNull();
|
|
|
|
|
expect(applyCompanyPrefix("/execution-workspaces/workspace-123", "PAP")).toBe(
|
|
|
|
|
"/PAP/execution-workspaces/workspace-123",
|
|
|
|
|
);
|
2026-05-01 11:58:15 -05:00
|
|
|
expect(applyCompanyPrefix("/execution-workspaces/workspace-123/routines", "PAP")).toBe(
|
|
|
|
|
"/PAP/execution-workspaces/workspace-123/routines",
|
|
|
|
|
);
|
2026-03-28 11:53:31 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("normalizes prefixed execution workspace paths back to company-relative paths", () => {
|
|
|
|
|
expect(toCompanyRelativePath("/PAP/execution-workspaces/workspace-123")).toBe(
|
|
|
|
|
"/execution-workspaces/workspace-123",
|
|
|
|
|
);
|
2026-05-01 11:58:15 -05:00
|
|
|
expect(toCompanyRelativePath("/PAP/execution-workspaces/workspace-123/routines")).toBe(
|
|
|
|
|
"/execution-workspaces/workspace-123/routines",
|
|
|
|
|
);
|
2026-04-06 16:19:41 +01:00
|
|
|
});
|
2026-03-28 11:53:31 -05:00
|
|
|
});
|