import { describe, expect, it } from 'vitest'; import { safeHtml } from './sanitize'; describe('safeHtml', () => { it('returns empty string for null/undefined/empty input', () => { expect(safeHtml(null)).toBe(''); expect(safeHtml(undefined)).toBe(''); expect(safeHtml('')).toBe(''); }); it('keeps allowed tags: p, strong, em, br, h2, h3, ul, ol, li', () => { const html = '

bold italic
x

' + '

H2

H3

' + '
  1. b
'; const result = safeHtml(html); expect(result).toContain('bold'); expect(result).toContain('italic'); expect(result).toContain('
'); expect(result).toContain('

H2

'); expect(result).toContain('

H3

'); expect(result).toContain('