import fs from 'node:fs'; import assert from 'node:assert/strict'; const html = fs.readFileSync(new URL('../www/index.html', import.meta.url), 'utf8'); const main = fs.readFileSync(new URL('../www/main.js', import.meta.url), 'utf8'); const realtime = fs.readFileSync(new URL('../www/views/realtime.js', import.meta.url), 'utf8'); const styleSelect = html.match(/]*\bid="styleSel"[^>]*>/)?.[0] || ''; assert(styleSelect, 'style selector is missing'); assert(!/\bopt-w-\d+\b/.test(styleSelect), 'style selector must not have a fixed-width utility class'); assert(/adjustStyleDropdownWidth\(\)/.test(main), 'dynamic style selector sizing is missing'); assert(/styleSel\.style\.width\s*=/.test(main), 'dynamic style selector width assignment is missing'); assert(!/syncNativePeakHold/.test(realtime), 'native RTA peak anchors must not be copied directly into the visible hold line'); assert((realtime.match(/applyPeakHold\(state, integrated, CONFIG, range\)/g) || []).length >= 3, 'every RTA engine must advance peak hold on the display clock'); assert(/useIirEngine[^]*?applyRealtimeBarBallistics\(state, displayBase, CONFIG, range\)/.test(realtime), 'native IIR bars must advance their visible release on the display clock'); console.log('GUI contract regression tests passed');