import { renderMarkdownToHtml } from '../../frontend/src/app/core/services/markdown.pure'; describe('Landing welcome binding (mirrors landing.component.ts/.html)', () => { function welcomeHtmlFor(payload: { welcomeMarkdown: string } | null | undefined): string { return renderMarkdownToHtml(payload?.welcomeMarkdown ?? ''); } it('renders the welcome Markdown from the bootstrap payload', () => { const html = welcomeHtmlFor({ welcomeMarkdown: '# Welcome\n\nCreate the first admin to get started.', }); expect(typeof html).toBe('string'); expect(html).toContain('

Welcome

'); expect(html).toContain('Create the first admin to get started.'); expect(html).not.toContain('=>{if'); }); it('produces a safe empty string when payload is missing', () => { expect(typeof welcomeHtmlFor(null)).toBe('string'); expect(welcomeHtmlFor(null)).not.toContain('=>{if'); }); it('produces a safe empty string when welcomeMarkdown is empty', () => { expect(typeof welcomeHtmlFor({ welcomeMarkdown: '' })).toBe('string'); expect(welcomeHtmlFor({ welcomeMarkdown: '' })).not.toContain('=>{if'); }); it('keeps sanitization when the welcome Markdown contains hostile content', () => { const html = welcomeHtmlFor({ welcomeMarkdown: '# Hello\n\n\n\n[bad](javascript:alert(1))', }); expect(html).toContain('

Hello

'); expect(html).not.toContain('