import test from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { renderApplicationHtml } from '../testSupport/applicationHtml.mjs'; import { createBrowserViteConfig } from '../../build/vite.js'; import { R820T_GAIN_STEPS_DB } from '../sdr/gain.js'; const html = await renderApplicationHtml( readFileSync(new URL('../../index.html', import.meta.url), 'utf8'), ); const css = readFileSync( new URL('./styles/radio.css', import.meta.url), 'utf8', ); test('the Local RTL-SDR card lives inside the Radio panel with every control', () => { const radioStart = html.indexOf('id="radio-panel"'); const cardStart = html.indexOf('id="sdr-radio-card"'); const radioEnd = html.indexOf('', radioStart); assert.ok(radioStart >= 0 && cardStart > radioStart && cardStart < radioEnd); for (const id of [ 'sdr-connection-state', 'sdr-connect-btn', 'sdr-locate-btn', 'sdr-change-device-btn', 'sdr-mode-fm-btn', 'sdr-mode-adsb-btn', 'sdr-gain-select', 'sdr-adsb-stats', 'sdr-stat-rate', 'sdr-stat-heard', 'sdr-stat-positioned', 'sdr-stat-iq', 'sdr-frequency-input', 'sdr-tune-btn', 'sdr-seek-back-btn', 'sdr-seek-forward-btn', 'sdr-volume', 'sdr-status', 'sdr-feed-status', ]) { assert.match(html, new RegExp(`id="${id}"`), `${id} is missing`); } assert.match(html, /id="sdr-status"[^>]*>Connect an RTL-SDR to begin\. { const start = html.indexOf('id="sdr-gain-select"'); const select = html.slice(start, html.indexOf('', start)); const values = [...select.matchAll(/