import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import test from "node:test"; import { renderToReadableStream } from "hono/jsx/streaming"; import { otherEntries } from "./components/other-index.tsx"; import { PageNav } from "./components/page-nav.tsx"; import { Site } from "./components/site.tsx"; import { ServicesContent } from "./components/services.tsx"; import { Shell } from "./components/shell.tsx"; import { Webring } from "./components/webring.tsx"; async function render(component: Parameters[0]): Promise { return new Response(renderToReadableStream(component)).text(); } test("site navigation keeps Services under Other", async () => { const html = await render(); const labels = [...html.matchAll(/]*>([^<]+)<\/a>/g)].map((match) => match[1]); assert.deepEqual(labels, ["About", "Blog", "Code", "Knowledge", "Other"]); assert.doesNotMatch(html, /href="\/services"/); assert.match(html, /Other<\/a>/); }); test("home navigation uses compact horizontal rails", async () => { const html = await render( , ); const css = await readFile(new URL("../public/site.css", import.meta.url), "utf8"); assert.match(html, />previous<\/a>]*>webring<\/a>]*>next<\/a>/); assert.doesNotMatch(html, />Letta webring { const html = await render(); const css = await readFile(new URL("../public/site.css", import.meta.url), "utf8"); assert.match(html, /

Hi, I'm Cameron\.<\/h1>/); assert.doesNotMatch(html, /webring|lettamates/); assert.match(css, /\.home-page \{[\s\S]*?text-align: center;/); assert.match(css, /\.home-greeting \{[\s\S]*?font-family: var\(--site-font-body\)/); assert.match(html, / { const home = await render(home); const page = await render(page); assert.doesNotMatch(home, /rel="preload" href="\/public\/fonts\/around-regular/); assert.match(page, /rel="preload" href="\/public\/fonts\/around-regular/); }); test("appearance controls avoid emoji and leave the mobile header", async () => { const html = await render( , ); const css = await readFile(new URL("../public/site.css", import.meta.url), "utf8"); const script = await readFile(new URL("../public/theme.js", import.meta.url), "utf8"); assert.match(html, /