import {describe, expect, test} from 'vitest'; import {DOM} from './dom'; describe('DOM', () => { describe('sanitize', () => { test('should not fail on empty string', () => { const input = ''; const output = DOM.sanitize(input); expect(output).toBe(''); }); test('should remove script tags', () => { const input = ''; const output = DOM.sanitize(input); expect(output).toBe(''); }); test('should remove script tags from nested elements', () => { const input = '
'; const output = DOM.sanitize(input); expect(output).toBe(''); }); test('should remove potentially dangerous attributes', () => { const input = 'click me'; const output = DOM.sanitize(input); expect(output).toBe('click me'); }); test('should remove potentially dangerous attributes from img', () => { const input = '