Frontend unit tests cover durations, colours, statistics and health (closes #21)
check / check (push) Successful in 2m44s

New table-driven tests in test/unit/main.test.js: humanDuration, the
figure and sparkline colours either side of each latency boundary, a
target's min, max, average and median over an empty history, an
all-unreachable one, a mixed one, one of only answers and one whose
answers have different numbers of digits, and the four health states
either side of their thresholds, with targets found unreachable counted
as timed out. src/main.js exports the four names they need.

package.json gains a test script, which script/frontend-test runs with
the dot reporter and, if a test fails, again with the spec reporter
before failing. NODE_OPTIONS picks the reporter, since yarn appends its
arguments after the test files.

Model: opus-5-5
This commit is contained in:
2026-10-04 01:18:17 +00:00
parent 82bd142429
commit 2f0e30e220
6 changed files with 197 additions and 14 deletions
+2 -1
View File
@@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "node --test test/unit/*.test.js"
},
"license": "MIT",
"devDependencies": {