Commit Graph

2 Commits

Author SHA1 Message Date
you
383219b4cf test: add Number() casting tests for snr/rssi toFixed
6 tests covering string, number, null, negative, and integer
values through the Number(x).toFixed() pattern used across
observer-detail, home, traces, and live pages.
2026-03-24 20:18:51 +00:00
you
909b53c2b7 Add 41 frontend helper unit tests (app.js, nodes.js, hop-resolver.js)
Test pure functions from frontend JS files using vm.createContext sandbox:
- timeAgo: null/undefined handling, seconds/minutes/hours/days formatting
- escapeHtml: XSS chars, null input, type coercion
- routeTypeName/payloadTypeName: known types + unknown fallback
- truncate: short/long/null strings
- getStatusTooltip: role-specific threshold messages
- getStatusInfo: active/stale status for repeaters and companions
- renderNodeBadges: HTML output contains role badge
- sortNodes: returns sorted array
- HopResolver: init/ready, single/ambiguous/unknown prefix resolution,
  geo disambiguation with origin anchor, IATA regional filtering

Note: c8 coverage doesn't track vm.runInContext-evaluated code, so these
don't improve the c8 coverage numbers. The tests still validate correctness
of frontend logic in CI.
2026-03-24 01:19:56 +00:00