test: failing node-test fuer renderMarkdown

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jörg Lohrer 2026-04-28 08:00:13 +02:00
parent 0b287f9ff6
commit f606748c3e
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// app/src/lib/render/markdown.node.test.ts
// @vitest-environment node
import { describe, it, expect } from 'vitest';
import { renderMarkdown } from './markdown';
describe('renderMarkdown (Node-Kontext)', () => {
it('rendert einfaches Markdown im Node-Build ohne window', () => {
const html = renderMarkdown('# Hallo\n\nWelt mit *Kursiv* und [Link](https://example.com)');
expect(html).toContain('<h1');
expect(html).toContain('Hallo');
expect(html).toContain('<em>Kursiv</em>');
expect(html).toContain('href="https://example.com"');
});
it('sanitisiert XSS-Versuche', () => {
const html = renderMarkdown('<script>alert(1)</script>\n\nText');
expect(html).not.toContain('<script');
expect(html).toContain('Text');
});
it('hebt code-blocks mit highlight.js hervor', () => {
const html = renderMarkdown('```ts\nconst x: number = 1;\n```');
expect(html).toContain('class="hljs');
expect(html).toContain('language-ts');
});
});