function assert(condition: unknown, message = "assertion failed"): void { if (!condition) throw new Error(message); } import { renderToStaticMarkup } from "react-dom/server"; import DocumentationHelpLink, { DocumentationHelpProvider } from "../src/components/help/DocumentationHelpLink"; import FieldLabel from "../src/components/help/FieldLabel"; import { documentationHelpHref } from "../src/components/help/documentationHelp"; assert( documentationHelpHref({ topicId: "campaigns.workflow.complete-review" }) === "/docs?type=user&topic=campaigns.workflow.complete-review", "topic references use the stable Help Center query contract" ); assert( documentationHelpHref({ contextId: "campaign.review-send", documentationType: "admin" }) === "/docs?type=admin&context=campaign.review-send", "context references retain the requested audience projection" ); assert( documentationHelpHref({ topicId: "topic", anchorId: "details" }) === "/docs?type=user&topic=topic#details", "optional stable anchors are preserved" ); assert(documentationHelpHref({}) === null, "an empty reference does not create a misleading link"); const hostedMarkup = renderToStaticMarkup( ); assert(hostedMarkup.includes("https://govoplan.add-ideas.de/?type=user&context=files.list"), "the link falls back to hosted documentation when Docs is absent"); assert(hostedMarkup.includes('target="_blank"'), "hosted documentation is clearly external"); const localMarkup = renderToStaticMarkup( ); assert(localMarkup.includes("/docs?type=user&topic=docs.pattern.field-help"), "an enabled Docs module uses the local Help Center"); assert(!localMarkup.includes('target="_blank"'), "local documentation stays in the application"); const fieldMarkup = renderToStaticMarkup( Role ); assert(fieldMarkup.includes("topic=access.reference.admin-access-fields"), "field labels can link to stable reference topics");