import { describe, expect, it } from 'vitest'; import { markdownToDoc } from './markdown'; import { extractOutline } from './outline'; describe('extractOutline (issue #24)', () => { it('returns the heading tree with levels and text', () => { const doc = markdownToDoc( '# Handbook\n\nIntro paragraph.\n\n## Onboarding\n\n### Day one\n\n## Offboarding', ); expect(extractOutline(doc)).toEqual([ { id: 'handbook', level: 1, text: 'Handbook' }, { id: 'onboarding', level: 2, text: 'Onboarding' }, { id: 'day-one', level: 3, text: 'Day one' }, { id: 'offboarding', level: 2, text: 'Offboarding' }, ]); }); it('deduplicates repeated heading text with stable numeric suffixes', () => { const doc = markdownToDoc('# Notes\n\n## Notes\n\n## Notes'); expect(extractOutline(doc).map((entry) => entry.id)).toEqual(['notes', 'notes-2', 'notes-3']); }); });