import { describe, expect, test } from 'bun:test'; import { extractHeadingsFromMarkdown, joinRenderedContent } from './utils'; describe('smartfetch/utils', () => { test('extracts cleaned headings from markdown', () => { const headings = extractHeadingsFromMarkdown( ['# Intro', '## Details ###', '### C#', 'plain text'].join('\n'), ); expect(headings).toEqual(['Intro', 'Details', 'C#']); }); test('injects metadata comments after an XML declaration in html output', () => { const result = joinRenderedContent( '---\nsource: "smartfetch"\n---\n\n', 'ok', 'html', ); expect(result).toStartWith(''); expect(result).toContain(''); expect(result).toContain('ok'); }); });