test: act on review — the browser test named LoadStatistic but never mounted it

The suite was titled "a load reading ranks itself", commented as covering the
thresholds, and cross-referenced from Common.test.js as the place the painted
result is checked.  It mounted a hand-built `<Statistic color='warning'/>`.

So it proved that role tokens resolve distinctly -- which the roles suite two
blocks up already covers -- and would have stayed green with LoadStatistic
reverted to `orange`/`red`.  The same shape as the column-border test in #609:
a claim that outran its measurement.  It mounts the real helper at the real
thresholds now, and the reversion fails it.

The source guards are gone.  They scraped function bodies out of files with
indexOf slices, covered two helpers, and never executed a branch.  `loadRole`
and `healthRole` are pure exported functions instead, tested as mappings:
either side of both load thresholds, every SMART assessment, lower case (the
value comes from smartctl), and the case that matters most -- an unreadable
drive must report as unknown, never as healthy.

That is also the better answer to the jsdom problem that produced the guards.
jsdom rejects `color: var(--danger)` and drops it, so the mapping cannot be read
back off a rendered component; extracting it is the honest fix rather than
asserting on source text.

And the gallery was itself half-migrated: 15 Min. Load became `danger` while
5 Min. Load stayed `orange` -- in the one sample whose caption tells the reader
to go and check night and amber, where orange is byte-identical to --text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-01 18:17:18 -06:00
parent 675bd5d620
commit acd27fe28e
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 110 additions and 65 deletions

View file

@ -196,7 +196,7 @@ export function ThemeSamplePage() {
<Header as='h5' style={{marginTop: 24}}>Coloured readings, as Status draws them</Header>
<StatisticGroup>
<Statistic value='0.4' label='1 Min. Load'/>
<Statistic value='2.6' label='5 Min. Load' color='orange'/>
<Statistic value='2.6' label='5 Min. Load' color='warning'/>
<Statistic value='4.1' label='15 Min. Load' color='danger'/>
<Statistic value='48' label='Temp C°'/>
</StatisticGroup>