import { describe, it, expect } from 'vitest'; import { renderMarkdown } from '@/lib/markdown'; describe('renderMarkdown', () => { it('renders headings', () => { const html = renderMarkdown('# Hello'); expect(html).toContain('

Hello

'); }); it('renders bold and italic', () => { const html = renderMarkdown('**bold** and *italic*'); expect(html).toContain('bold'); expect(html).toContain('italic'); }); it('renders code blocks with language class', () => { const html = renderMarkdown('```js\nconst x = 1;\n```'); expect(html).toContain('language-js'); }); it('renders mermaid blocks with a placeholder', () => { const html = renderMarkdown('```mermaid\ngraph TD\nA-->B\n```'); expect(html).toContain('data-mermaid-source='); }); it('sanitizes dangerous HTML', () => { const html = renderMarkdown(''); expect(html).not.toContain('