// knobs.md's Modules section is generated from the modules' own docs // (modules/docs.mjs): it is current, and every module that has knobs has one. import { test } from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { DOCS_BEGIN, DOCS_END, KNOBS_MD, modulesMarkdown, withModulesSection } from "./docs.mjs"; import { MODULES } from "./index.mjs"; test("knobs.md's Modules section is current (node umtool/report-to-video/modules/docs.mjs rewrites it)", () => { const text = readFileSync(KNOBS_MD, "utf8"); assert.ok(text.includes(DOCS_BEGIN) && text.includes(DOCS_END), "the markers are in knobs.md"); assert.equal(withModulesSection(text), text); }); test("every module with a home in the manifest documents it, and the section names each", () => { const md = modulesMarkdown(); for (const m of MODULES) { if (!m.configKey) continue; assert.ok(m.docs, `${m.id} has docs`); assert.ok(md.includes(`### ${m.docs.heading}`), `${m.id}'s section`); assert.ok(md.includes(`\`${m.id}\``), `${m.id} in the table`); } // Idempotent: the section replaces itself. assert.equal(withModulesSection(withModulesSection("# x\n")), withModulesSection("# x\n")); });