/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ import {describe, expect, it} from 'vitest'; import {decodeHTMLEntities, htmlToMarkdown, stripHtmlTags} from './DOMUtils'; describe('DOMUtils', () => { describe('decodeHTMLEntities', () => { it('should decode common HTML entities', () => { expect(decodeHTMLEntities('&')).toBe('&'); expect(decodeHTMLEntities('<')).toBe('<'); expect(decodeHTMLEntities('>')).toBe('>'); expect(decodeHTMLEntities('"')).toBe('"'); expect(decodeHTMLEntities(''')).toBe("'"); }); it('should handle empty or null input', () => { expect(decodeHTMLEntities('')).toBe(''); expect(decodeHTMLEntities(null)).toBe(''); expect(decodeHTMLEntities(undefined)).toBe(''); }); it('should decode numeric entities', () => { expect(decodeHTMLEntities('A')).toBe('A'); expect(decodeHTMLEntities('€')).toBe('€'); }); it('should handle text without entities', () => { expect(decodeHTMLEntities('Hello World')).toBe('Hello World'); }); it('should decode mixed content', () => { expect(decodeHTMLEntities('Hello & goodbye <script>')).toBe('Hello & goodbye