import test from 'node:test'; import assert from 'node:assert/strict'; import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { runScript, repoRoot, tmpRoot } from './helpers/run-script.js'; const input = join(tmpRoot, 'capture-input.json'); const html = join(tmpRoot, 'capture.html'); const svg = join(tmpRoot, 'capture.svg'); const manifest = join(tmpRoot, 'capture-manifest.json'); const document = { schemaVersion: 1, source: { requirement: { repo: 'owner/repo', index: 7 } }, requirement: { title: 'Capture', summary: 'Fallback', goals: [], nonGoals: [], diagrams: [{ kind: 'flowchart', nodes: [{ id: 'a', label: 'A' }], edges: [] }] }, workPackages: [], overview: { generatedAt: '2026-09-18T00:00:00Z' }, }; import { mkdirSync, writeFileSync } from 'node:fs'; mkdirSync(tmpRoot, { recursive: true }); writeFileSync(input, `${JSON.stringify(document)}\n`); test('renderer emits SVG fallback alongside HTML', async () => { const result = await runScript('overview-render.js', ['--input', input, '--output', html, '--svg', svg, '--manifest', manifest]); assert.equal(result.code, 0, JSON.stringify(result.json)); assert.equal(existsSync(svg), true); assert.match(readFileSync(svg, 'utf8'), /^ { const result = await runScript('overview-capture.js', ['--backend', 'svg', '--svg', svg, '--output', join(tmpRoot, 'capture.png')]); if (result.code === 0) assert.equal(result.json.data.backend, 'svg'); else assert.equal(result.json.error.code, 'BINARY_NOT_FOUND'); });