From 8acfbf8c3ebc297ecde2e5e5cca90fd92218e134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hartmut=20N=C3=B6renberg?= Date: Tue, 31 Mar 2026 22:38:56 +0200 Subject: [PATCH] test(api): lock comment entity registry metadata --- .../__tests__/comment-entity-registry.test.ts | 17 +++++++++++++++++ .../shared/src/constants/comment-entities.ts | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100644 packages/api/src/__tests__/comment-entity-registry.test.ts create mode 100644 packages/shared/src/constants/comment-entities.ts diff --git a/packages/api/src/__tests__/comment-entity-registry.test.ts b/packages/api/src/__tests__/comment-entity-registry.test.ts new file mode 100644 index 0000000..2d390e9 --- /dev/null +++ b/packages/api/src/__tests__/comment-entity-registry.test.ts @@ -0,0 +1,17 @@ +import { describe, expect, it } from "vitest"; +import { + CommentEntityTypeSchema, + getCommentToolEntityDescription, + getCommentToolScopeSentence, + getSupportedCommentEntityTypes, +} from "../lib/comment-entity-registry.js"; + +describe("comment entity registry metadata", () => { + it("keeps the router schema and helper metadata aligned", () => { + expect(getSupportedCommentEntityTypes()).toEqual(["estimate", "resource"]); + expect(CommentEntityTypeSchema.options).toEqual(["estimate", "resource"]); + expect(getCommentToolEntityDescription()).toContain("estimate, resource"); + expect(getCommentToolScopeSentence()).toContain("Supported comment entities: estimate, resource."); + expect(getCommentToolScopeSentence()).toContain("resource comments follow resource detail visibility"); + }); +}); diff --git a/packages/shared/src/constants/comment-entities.ts b/packages/shared/src/constants/comment-entities.ts new file mode 100644 index 0000000..76ffe5e --- /dev/null +++ b/packages/shared/src/constants/comment-entities.ts @@ -0,0 +1,8 @@ +export const COMMENT_ENTITY_TYPE_VALUES = ["estimate", "resource"] as const; + +export type CommentEntityType = (typeof COMMENT_ENTITY_TYPE_VALUES)[number]; + +export const COMMENT_ENTITY_LABELS: Record = { + estimate: "estimate", + resource: "resource", +};