From 3c01f87858bd91a4563dd4256a28f2d4988aade2 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 04:46:20 -0400 Subject: [PATCH] test: cover crux route lookup and reference-definition link fallbacks getProjectFromPath's /docs/crux arm (added in #490) and rewriteDocLinks' reference-style definition fallbacks (added in #488) were the only lines and branches left unexecuted in those two files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/__tests__/rewriteDocLinks.test.ts | 12 ++++++++++++ src/__tests__/versions.test.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/__tests__/rewriteDocLinks.test.ts b/src/__tests__/rewriteDocLinks.test.ts index 7a5f7ced..c0b59138 100644 --- a/src/__tests__/rewriteDocLinks.test.ts +++ b/src/__tests__/rewriteDocLinks.test.ts @@ -85,6 +85,18 @@ describe("rewriteRelativeDocLinks", () => { ); }); + it("rewrites reference-style definitions without a title", () => { + expect(rewriteRelativeDocLinks("[id]: architecture.md", "hive")).toBe( + "[id]: /docs/hive/architecture" + ); + }); + + it("leaves non-doc reference-style definitions unchanged", () => { + same("[ext]: https://example.com/page"); + same("[abs]: /docs/hive/architecture"); + same("[img]: diagram.png"); + }); + it("preserves CommonMark titles", () => { expect(rewriteRelativeDocLinks('[x](x.md "Title")', "hive")).toBe( '[x](/docs/hive/x "Title")' diff --git a/src/__tests__/versions.test.ts b/src/__tests__/versions.test.ts index 6d557dbf..cc23e0a9 100644 --- a/src/__tests__/versions.test.ts +++ b/src/__tests__/versions.test.ts @@ -28,6 +28,8 @@ describe("getProjectFromPath", () => { ["/docs/rationguard/install", "rationguard"], ["/docs/promptargs", "promptargs"], ["/docs/dibs", "dibs"], + ["/docs/crux", "crux"], + ["/docs/crux/getting-started", "crux"], ["/docs/spektacular/api", "spektacular"], ] as const)("maps %s to project %s", (pathname, id) => { expect(getProjectFromPath(pathname).id).toBe(id);