import { describe, expect, it } from "vitest"; import type { ManifestModule } from "@govlab/docs/types/manifest.types.ts"; import { governanceMessages } from "@govlab/docs/core/validators/readme.validator.ts"; const CLEAN = { governConcepts: (): never[] => [], governDeclaredDocs: (): never[] => [], governManifest: (): never[] => [], governPrinciples: (): never[] => [], }; const moduleWith = function moduleWith(manifest: Record): ManifestModule { return { dir: "module-under-test", group: "test", label: "mod", manifest, pkg: {}, relPath: "test/mod", slug: "mod", }; }; describe("governanceMessages", () => { it("emits nothing when the engine reports clean", () => { expect( governanceMessages(CLEAN, moduleWith({ docs: {} }), { generatedPrefix: "\n# Title" }; expect(governanceMessages(CLEAN, moduleWith({}), context)).toStrictEqual([ expect.stringContaining("docs-incomplete"), ]); }); it("formats each engine finding with its manifest field", () => { const engine = { ...CLEAN, governManifest: () => [{ axis: "history-smell", detail: "d", field: "overview" }] }; expect( governanceMessages(engine, moduleWith({ docs: {} }), { generatedPrefix: "