import {
afterAll,
afterEach,
beforeAll,
beforeEach,
clock,
describe,
expect,
it,
mock,
test,
} from 'runtime:test';
import { escapeHTML, unescapeHTML } from '../../src';
describe('String > unescapeHTML', () => {
test('unescapes all supported entities', () => {
expect(unescapeHTML('<div>')).toBe('
');
expect(unescapeHTML('"hello"')).toBe('"hello"');
expect(unescapeHTML(''single'')).toBe("'single'");
expect(unescapeHTML(''single'')).toBe("'single'");
expect(unescapeHTML('Tom & Jerry')).toBe('Tom & Jerry');
});
test('round-trips with escapeHTML', () => {
const original = '';
expect(unescapeHTML(escapeHTML(original))).toBe(original);
});
test('round-trips a backtick, which escapeHTML also escapes', () => {
expect(escapeHTML('`')).toBe('`');
expect(unescapeHTML('`')).toBe('`');
const original = 'a `template` & "c"';
expect(unescapeHTML(escapeHTML(original))).toBe(original);
});
test('handles strings without entities', () => {
expect(unescapeHTML('hello')).toBe('hello');
});
});