{"version":3,"sources":["../../src/sections/table-of-contents.test.ts"],"sourcesContent":["import { DocumentSection, DocumentSectionOptions } from './section.js';\nimport { tableOfContentsSection } from './table-of-contents.js';\n\nconst createTestSection = (options: DocumentSectionOptions) => {\n  class TestDocumentSection extends DocumentSection {\n    protected synthesizeContent(): string[] {\n      return [this.title];\n    }\n  }\n\n  return new TestDocumentSection(options);\n};\n\ndescribe('table of contents', () => {\n  it('should create a section with the title Table of Contents', () => {\n    expect(\n      tableOfContentsSection({\n        sections: [createTestSection({ title: 'Test Section' })],\n      }).title,\n    ).toBe('Table of Contents');\n  });\n\n  it('should return the correct syntax for the title and table of contents', () => {\n    const tableOfContents = tableOfContentsSection({\n      sections: [createTestSection({ title: 'Test Section' })],\n    });\n\n    expect(tableOfContents.synthesize()).toBe(\n      ['## Table of Contents', '', '- [Test Section](#test-section)'].join(\n        '\\n',\n      ),\n    );\n  });\n\n  it('should return the correct syntax for the title and table of contents with multiple sections', () => {\n    const tableOfContents = tableOfContentsSection({\n      sections: [\n        createTestSection({ title: 'Test Section' }),\n        createTestSection({ title: 'Test Section 2' }),\n      ],\n    });\n\n    expect(tableOfContents.synthesize()).toBe(\n      [\n        '## Table of Contents',\n        '',\n        '- [Test Section](#test-section)',\n        '- [Test Section 2](#test-section-2)',\n      ].join('\\n'),\n    );\n  });\n\n  it('should return the correct syntax for the title and table of contents with root and sub sections', () => {\n    const rootSection = createTestSection({ title: 'Root Section' });\n    createTestSection({\n      title: 'Sub Section',\n      parent: rootSection,\n    });\n\n    const tableOfContents = tableOfContentsSection({\n      sections: [rootSection],\n    });\n\n    expect(tableOfContents.synthesize()).toBe(\n      [\n        '## Table of Contents',\n        '',\n        '- [Root Section](#root-section)',\n        '  - [Sub Section](#sub-section)',\n      ].join('\\n'),\n    );\n  });\n});\n"],"mappings":";AAAA,qBAAwD;AACxD,+BAAuC;AAEvC,MAAM,oBAAoB,CAAC,YAAoC;AAAA,EAC7D,MAAM,4BAA4B,+BAAgB;AAAA,IACtC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