20 lines
709 B
JavaScript
20 lines
709 B
JavaScript
import { describe, expect, it } from 'vitest'
|
|
import { renderMarkdownContent } from './vite-plugin-content.js'
|
|
|
|
describe('markdown content rendering', () => {
|
|
it('removes only an initial level-one heading', () => {
|
|
const html = renderMarkdownContent('# Duplicate title\n\nIntro\n\n## Section')
|
|
|
|
expect(html).not.toContain('<h1>Duplicate title</h1>')
|
|
expect(html).toContain('<p>Intro</p>')
|
|
expect(html).toContain('<h2>Section</h2>')
|
|
})
|
|
|
|
it('keeps content when no initial level-one heading exists', () => {
|
|
const html = renderMarkdownContent('Intro\n\n# Deliberate heading')
|
|
|
|
expect(html).toContain('<p>Intro</p>')
|
|
expect(html).toContain('<h1>Deliberate heading</h1>')
|
|
})
|
|
})
|