Top Level
Sub Section
Body text
Hello world
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('Hello world')); }); it('processes HTML with only a heading', async () => { const res = await crawlHtml('Tom & Jerry
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('Tom & Jerry')); }); it('decodes < to < in output', async () => { const res = await crawlHtml('1 < 2
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('1 < 2')); }); it('decodes > to > in output', async () => { const res = await crawlHtml('2 > 1
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('2 > 1')); }); }); describe('unicode content', () => { it('preserves Japanese characters', async () => { const res = await crawlHtml('日本語テスト
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('日本語テスト')); }); it('preserves emoji characters', async () => { const res = await crawlHtml('Hello 🌍 World
'); assert.strictEqual(res.status, 200); assert.ok(res.body.data.content.includes('🌍')); }); }); describe('nested document structure', () => { it('extracts headings from nested article/section elements', async () => { const html = `Body text
Same every time.
'; const [r1, r2] = await Promise.all([crawlHtml(html), crawlHtml(html)]); assert.strictEqual(r1.status, 200); assert.strictEqual(r2.status, 200); assert.strictEqual(r1.body.data.content, r2.body.data.content); }); });