/** * App Settings structural guard. * * The settings modal is a rail (table of contents) over ONE scrolling document. * Its load/save path is pure `getElementById` by a fixed set of ids * (openAppSettings / saveAppSettings in settings-ui.js), so a restructure of the * markup that drops or renames an element does not fail loudly: the setting just * silently stops loading, or stops being saved and falls back to its default. * * These tests read the REAL settings-ui.js and index.html and pin that contract. */ import { describe, it, expect } from 'vitest'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; const publicDir = resolve(import.meta.dirname, '../src/web/public'); const html = readFileSync(resolve(publicDir, 'index.html'), 'utf8'); const settingsUi = readFileSync(resolve(publicDir, 'settings-ui.js'), 'utf8'); /** The App Settings modal markup, so assertions can't be satisfied elsewhere. */ function settingsModal(): string { const start = html.indexOf('