const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const test = require('node:test'); const root = path.join(__dirname, '..'); function read(relativePath) { return fs.readFileSync(path.join(root, relativePath), 'utf8'); } test('dashboard starts live polling and exposes required controls', () => { const html = read('frontend/index.html'); const dashboard = read('frontend/dashboard.js'); assert.match(html, /id="history-interval"/); assert.match(dashboard, /updateDashboard\(\);/); assert.match( dashboard, /setInterval\(updateDashboard,\s*POLLING_INTERVAL_MS\)/ ); }); test('dashboard HTML has balanced structural containers', () => { const html = read('frontend/index.html'); const openDivs = (html.match(//g) || []).length; const openSections = (html.match(//g) || []).length; assert.equal(openDivs, closeDivs); assert.equal(openSections, closeSections); }); test('terminal output does not append untrusted HTML', () => { const service = read('frontend/ezo-service.js'); assert.doesNotMatch(service, /terminalOutput\.innerHTML/); assert.match(service, /line\.textContent = message/); }); test('sensor Makefiles reference their real implementation objects', () => { assert.match(read('sensors/EZOPH/Makefile'), /OBJ=main\.o ezoph\.o/); assert.match(read('sensors/EZODO/Makefile'), /OBJ=main\.o ezodo\.o/); assert.match(read('sensors/EZOEC/Makefile'), /OBJ=main\.o ezoec\.o/); assert.ok(read('sensors/EZODO/main.c').trim().length > 0); });