web: waterfall nav tests track the shared status-nav builder (#1247)
The two-row nav (#1222) moved the status nav into status-nav.js — pages declare data-title and the builder marks the current pill at runtime — but the Investing-nav contract tests still asserted the old static markup, so npm test broke on main after the squash. Same intent, new contract: funding.html titles itself Investing and mounts the shared nav; every page mounts it; the builder carries the Investing tab.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 file changed,
+11
−4
test/waterfall.test.mjs+11 −4
diff --git a/test/waterfall.test.mjs b/test/waterfall.test.mjs| index 6073f6b..98b60ca 100644 |
| --- a/test/waterfall.test.mjs |
| +++ b/test/waterfall.test.mjs |
| @@ -111,20 +111,27 @@ await test("web/status/funding.json holds the ledger shape the page reads", () = |
| }); |
| // The Investing page must run the served module and read the committed |
| -// ledger — never carry a copy of either. |
| +// ledger — never carry a copy of either. The nav is the SHARED builder |
| +// (status-nav.js, #1222): pages declare their identity via data-title and |
| +// the builder marks the current pill at runtime — no static nav markup. |
| await test("funding.html imports ./waterfall.js and fetches ./funding.json", () => { |
| const html = readFileSync(new URL("../web/status/funding.html", import.meta.url), "utf8"); |
| assert.ok(html.includes('from "./waterfall.js"')); |
| assert.ok(html.includes('fetch("./funding.json"')); |
| - assert.ok(html.includes('<span aria-current="page">Investing</span>')); |
| + assert.ok(html.includes('data-title="Investing"')); |
| + assert.ok(html.includes('src="./status-nav.js"')); |
| }); |
| -// Every status page links the Investing tab (the ten-item nav stays in step). |
| +// Every status page mounts the shared nav, and the nav carries the |
| +// Investing tab — the one place the link lives now (#1222). |
| await test("all status pages carry the Investing nav link", () => { |
| + const nav = readFileSync(new URL("../web/status/status-nav.js", import.meta.url), "utf8"); |
| + assert.ok(nav.includes('"funding.html"') || nav.includes('"./funding.html"')); |
| + assert.ok(nav.includes('"Investing"')); |
| for (const page of ["index", "books", "economics", "carbon", "contributors", |
| "security", "prompts", "ssh", "hardening", "milestones"]) { |
| const html = readFileSync(new URL("../web/status/" + page + ".html", import.meta.url), "utf8"); |
| - assert.ok(html.includes('"./funding.html"'), page); |
| + assert.ok(html.includes('src="./status-nav.js"'), page); |
| } |
| }); |