const test = require('node:test'); const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const root = path.resolve(__dirname, '..'); const indexHtml = fs.readFileSync(path.join(root, 'public', 'index.html'), 'utf8'); const settingsSource = fs.readFileSync(path.join(root, 'public', 'js', 'pages', 'Settings.js'), 'utf8'); test('Settings exposes separate live check-new and full rebuild actions', () => { assert.ok(/id="live-check-new-button"[^>]*>\s*Check for new streams\s*]*>\s*Run full refresh\s* { assert.ok(/getElementById\('live-check-new-button'\).*addEventListener/s.test(settingsSource), 'Settings should bind the check-new button'); assert.ok(/getElementById\('live-rebuild-catalog-button'\).*addEventListener/s.test(settingsSource), 'Settings should bind the full rebuild button'); assert.ok(/projection\/check-new|checkNewStreams|checkNew/.test(settingsSource), 'Settings should call a check-new API action'); assert.ok(/projection\/rebuild|rebuildProjection|runLiveAnalysis/.test(settingsSource), 'Settings should keep a full rebuild API action'); });