// SPDX-License-Identifier: GPL-3.0-or-later /** * Dashboard state invariants, evaluated against the BUILT src-gui/index.html * in a stubbed browser environment (vm), like tests/gui-smoke.test.js. * * Pins the two behaviors a restyle can most easily break silently: * 1. pollPaused() — auto-refresh must pause while the user is reading * (search text, non-All filter, an open card, rerun in flight, or a * hidden tab), so a background refresh never yanks their place away. * 2. renderTrend() first-run states — zero recorded runs hides History; * exactly one run explains what will grow there (with its score); * corrupt/scoreless entries degrade to "no history". */ import { test } from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import vm from "node:vm"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; const ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); const html = readFileSync(join(ROOT, "src-gui", "index.html"), "utf8"); const script = html.match(/