import assert from 'node:assert'; import { readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { describe, test } from 'node:test'; import { JSDOM } from 'jsdom'; import DOMPurify from 'dompurify'; import { enhanceOrgHtml } from './enhanceHtml.js'; import { orgToHtmlSync, orgToRawHtmlSync } from './pipeline.js'; import { ORG_SANITIZE_OPTIONS } from './constants.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); const fixturesDir = join(__dirname, 'fixtures'); function loadFixture(name) { return readFileSync(join(fixturesDir, name), 'utf8'); } function sanitizeInNode(html) { const window = new JSDOM('').window; const purify = DOMPurify(window); return purify.sanitize(html, ORG_SANITIZE_OPTIONS); } describe('Org pipeline', () => { test('renders headings and nested sections', () => { const html = orgToRawHtmlSync(loadFixture('headings-todo.org')); assert.match(html, /