import { test } from 'node:test'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import vm from 'node:vm'; import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const skillRoot = path.resolve(__dirname, '..'); const repoRoot = path.resolve(skillRoot, '..'); test('guide page: checked-in HTML is reproducible from the shared recipe source', () => { const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-guide-page-')); const generated = path.join(tmp, 'guide.html'); try { execFileSync(process.execPath, [path.join(repoRoot, 'scripts/build-guide.mjs'), generated]); assert.equal( fs.readFileSync(generated, 'utf8'), fs.readFileSync(path.join(repoRoot, 'docs/guide.html'), 'utf8'), ); } finally { fs.rmSync(tmp, { recursive: true, force: true }); } }); test('guide page: ships bilingual recipes and syntactically valid interaction code', () => { const html = fs.readFileSync(path.join(repoRoot, 'docs/guide.html'), 'utf8'); assert.doesNotMatch(html, /\[\[[A-Z0-9_]+\]\]/); assert.match(html, /Question-first diagramming/); assert.match(html, /先问题,后图表/); assert.match(html, /archify guide "your scenario"|archify guide "your scenario"/); const dataMatch = html.match(/