// SPDX-License-Identifier: AGPL-3.0-or-later import {describe, expect, it} from 'vitest'; import {hasVisibleContent, parseString} from '../StringUtils'; describe('parseString', () => { it('returns trimmed string within max length', () => { expect(parseString('Hello World', 50)).toBe('Hello World'); }); it('trims whitespace from the string', () => { expect(parseString(' Hello World ', 50)).toBe('Hello World'); }); it('truncates string exceeding max length', () => { const result = parseString('This is a very long string that needs truncation', 20); expect(result.length).toBeLessThanOrEqual(20); expect(result).toContain('...'); }); it('handles exact max length', () => { const result = parseString('12345', 5); expect(result).toBe('12345'); }); it('decodes HTML entities before processing', () => { expect(parseString('Hello & World', 50)).toBe('Hello & World'); expect(parseString('<script>', 50)).toBe('