diff --git a/packages/cli/src/fontLocalize.test.ts b/packages/cli/src/fontLocalize.test.ts index 9637b2b0e..86a9d2384 100644 --- a/packages/cli/src/fontLocalize.test.ts +++ b/packages/cli/src/fontLocalize.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import { runFontLocalize, stampFontCompilerVersion, type FontLocalizeIo } from "./fontLocalize.js"; +import { runFontLocalize, stampFontVersions, type FontLocalizeIo } from "./fontLocalize.js"; function makeIo(input: string): { io: FontLocalizeIo; @@ -71,16 +71,39 @@ describe("runFontLocalize", () => { }); }); -describe("stampFontCompilerVersion", () => { - it("records the compiler version inside the document head", () => { - const stamped = stampFontCompilerVersion( +describe("stampFontVersions", () => { + it("records producer and localizer versions inside the document head", () => { + const stamped = stampFontVersions( "x", - "0.8.15", + { producer: "0.8.15", localizer: "0.8.16" }, ); expect(stamped).toContain(''); + expect(stamped).toContain(''); expect(stamped.indexOf("hyperframes-font-compiler-version")).toBeLessThan( stamped.indexOf(""), ); }); + + it("inserts both diagnostic stamps after a doctype when no head close exists", () => { + const stamped = stampFontVersions("
x
", { + producer: "0.8.15", + localizer: "0.8.16", + }); + + expect(stamped).toMatch( + /^/, + ); + }); + + it("inserts both diagnostic stamps at the start when no head or doctype exists", () => { + const stamped = stampFontVersions("
x
", { + producer: "0.8.15