feat(cli): stamp font compiler version in localized HTML

This commit is contained in:
Miguel Ángel
2026-08-26 01:11:38 +00:00
parent ec68d40cc6
commit d6de083411
3 changed files with 33 additions and 5 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import { runFontLocalize, type FontLocalizeIo } from "./fontLocalize.js";
import { runFontLocalize, stampFontCompilerVersion, type FontLocalizeIo } from "./fontLocalize.js";
function makeIo(input: string): {
io: FontLocalizeIo;
@@ -70,3 +70,17 @@ describe("runFontLocalize", () => {
expect(harness.errors.join(" ")).toContain("empty output");
});
});
describe("stampFontCompilerVersion", () => {
it("records the compiler version inside the document head", () => {
const stamped = stampFontCompilerVersion(
"<!doctype html><html><head><title>x</title></head><body></body></html>",
"0.8.15",
);
expect(stamped).toContain('<meta name="hyperframes-font-compiler-version" content="0.8.15">');
expect(stamped.indexOf("hyperframes-font-compiler-version")).toBeLessThan(
stamped.indexOf("</head>"),
);
});
});