// tests/scripts/render-artifact.test.mjs // Covers scripts/render-artifact.mjs — the v5.0.0 self-contained HTML // renderer that /trekbrief, /trekplan, /trekreview call at the end of their // run to produce a browser-readable view of the just-written artifact. import { test } from 'node:test'; import { strict as assert } from 'node:assert'; import { mkdtempSync, writeFileSync, readFileSync, rmSync, existsSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { buildHtml, renderMarkdown, render, parseArgs } from '../../scripts/render-artifact.mjs'; const SAMPLE = `--- type: trekplan plan_version: "1.7" task: "Render-artifact smoke test" slug: render-smoke --- # Render-artifact smoke test A paragraph with **bold**, \`inline code\`, and a [link](https://example.com). ## Steps - top item - nested item - second top item 1. ordered one 2. ordered two \`\`\`js const x = 1; \`\`\` > a blockquote line | Col A | Col B | |-------|-------| | 1 | 2 | `; test('buildHtml produces a complete self-contained HTML document', () => { const html = buildHtml('plan.md', SAMPLE); assert.ok(html.startsWith(''), 'must start with doctype'); assert.ok(html.includes(''), 'must close html'); assert.ok(html.includes('