import assert from 'node:assert/strict' import { mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { test } from 'node:test' import { createOutput, discardOutput, publishOutput } from '../output.js' import { readPages } from '../content.js' import { generatedRoot, siteUrl } from '../site.config.js' test('headings have unique IDs and matching TOC links', async () => { const html = await readFile(join(generatedRoot, 'notes', 'steam', 'index.html'), 'utf8') const ids = [...html.matchAll(/ match[1]) const links = [...html.matchAll(//g)].map((match) => match[1]) assert.ok(ids.length > 1) assert.equal(new Set(ids).size, ids.length) assert.deepEqual(links, ids) }) test('sidenotes render Markdown with paired, unique controls', async () => { const html = await readFile(join(generatedRoot, 'notes', 'lua', 'index.html'), 'utf8') const controls = [...html.matchAll(/ match[1]) assert.deepEqual(controls, ['sidenote-1', 'sidenote-2']) for (const id of controls) assert.ok(html.includes(`