railyard/apps/relay/ui/app/utils/docs-url.test.ts
caelum0x 994f2d1a31 feat(relay): drop upstream marketing, Relay UI naming, pinned docs links, Autopilot off
README rewritten with engine features, not-available list and Apache-2.0
attribution (forked from TensorZero 2026.6.0). UI status indicator, logger
prefix and warnings renamed to Relay (RELAY_UI_LOG_LEVEL with legacy alias).
Help links resolve via docs-url.ts to pinned engine docs (VITE_RELAY_DOCS_URL
override); fixed SFT link. /autopilot always shows the unavailable page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:23:22 +03:00

28 lines
1005 B
TypeScript

import { describe, expect, it } from "vitest";
import { buildDocsUrl, DEFAULT_DOCS_SOURCE_BASE } from "./docs-url";
describe("buildDocsUrl", () => {
it("links to the pinned MDX source by default", () => {
expect(buildDocsUrl("gateway/guides/episodes")).toBe(
`${DEFAULT_DOCS_SOURCE_BASE}/gateway/guides/episodes.mdx`,
);
expect(DEFAULT_DOCS_SOURCE_BASE).not.toContain("tensorzero.com");
});
it("keeps anchors after the file extension", () => {
expect(buildDocsUrl("gateway/create-a-prompt-template#migrate")).toBe(
`${DEFAULT_DOCS_SOURCE_BASE}/gateway/create-a-prompt-template.mdx#migrate`,
);
});
it("uses an operator docs base without an extension", () => {
expect(
buildDocsUrl("/gateway/guides/episodes/", "https://docs.example.com/"),
).toBe("https://docs.example.com/gateway/guides/episodes");
});
it("ignores a blank operator base", () => {
expect(buildDocsUrl("a/b", " ")).toBe(`${DEFAULT_DOCS_SOURCE_BASE}/a/b.mdx`);
});
});