import { describe, expect, test } from "bun:test"; import { DocumentMetadataError, validateDescription } from "./validation"; describe("validate description", () => { test("rejects multiple sentences", () => { expect(() => validateDescription("First sentence. Second sentence.")).toThrow( DocumentMetadataError, ); }); test("returns a trimmed description", () => { expect(validateDescription(" One sentence only. ")).toBe("One sentence only."); }); test("accepts technical tokens with internal dots", () => { expect( validateDescription("TypeScript execution engine that runs `.ts` files directly in Node.js."), ).toBe("TypeScript execution engine that runs `.ts` files directly in Node.js."); }); test("accepts version numbers and dotted binary names", () => { expect( validateDescription("Converts PostScript to PDF 1.4 compatibility output with ps2pdf14."), ).toBe("Converts PostScript to PDF 1.4 compatibility output with ps2pdf14."); }); });