#!/usr/bin/env node /** * ObsiGate — Frontend unit tests (pure functions, no DOM required). * Usage: node tests/frontend/unit.test.mjs */ import { strict as assert } from 'assert'; // ── Test escapeHtml (from utils.js) ──────────────────────────────────────── // We test the logic directly since utils.js imports from state.js which needs DOM const escapeHtml = (str) => { if (!str) return ''; return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); }; function testEscapeHtml() { assert.strictEqual(escapeHtml(''), ''); assert.strictEqual(escapeHtml(null), ''); assert.strictEqual(escapeHtml(undefined), ''); assert.strictEqual(escapeHtml('hello'), 'hello'); assert.strictEqual(escapeHtml('