you
2adf4f668b
test: 101 server route tests via supertest — 76% coverage
...
server.js now exportable via require.main guard.
Tests every API endpoint: stats, nodes, packets, channels, observers,
traces, analytics, config, health, perf, resolve-hops.
Covers: params, pagination, error paths, region filtering.
2026-03-24 01:57:55 +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
you
9f5f2922ee
Add spec-driven decoder tests with golden fixtures from production
...
- 255 assertions: spec-based header/path/transport/advert parsing + 20 golden packets
- Verifies header bit layout, path encoding, advert flags/location/name per firmware spec
- Golden fixtures from analyzer.00id.net catch regressions if decoder output changes
- Notes 5 discrepancies: 4 missing payload types (GRP_DATA, MULTIPART, CONTROL, RAW_CUSTOM)
and encrypted payload field sizes differ from spec (decoder matches prod behavior)
2026-03-24 01:16:52 +00:00
you
21e7996c98
Extract server-helpers.js and add unit tests for server logic + db.js
...
- Extract pure/near-pure functions from server.js into server-helpers.js:
loadConfigFile, loadThemeFile, buildHealthConfig, getHealthMs,
isHashSizeFlipFlop, computeContentHash, geoDist, deriveHashtagChannelKey,
buildBreakdown, disambiguateHops, updateHashSizeForPacket, rebuildHashSizeMap,
requireApiKey
- Add test-server-helpers.js (70 tests) covering all extracted functions
- Add test-db.js (68 tests) covering all db.js exports with temp SQLite DB
- Coverage: 39.97% → 81.3% statements, 56% → 68.5% branches, 65.5% → 89.5% functions
2026-03-24 01:09:03 +00:00
you
3fdad47bfc
Add decoder and packet-store unit tests
...
- test-decoder.js: 52 tests covering all payload types (ADVERT, GRP_TXT, TXT_MSG, ACK, REQ, RESPONSE, ANON_REQ, PATH, TRACE, UNKNOWN), header parsing, path decoding, transport codes, edge cases, validateAdvert, and real packets from the API
- test-packet-store.js: 34 tests covering insert, deduplication, indexing (byHash, byNode, byObserver, advertByObserver), query with filters (type, route, hash, observer, since, until, order), queryGrouped, eviction, findPacketsForNode, getSiblings, countForNode, getTimestamps, getStats
Coverage improvement:
- decoder.js: 73.9% → 85.5% stmts, 41.7% → 89.3% branch, 69.2% → 92.3% funcs
- packet-store.js: 53.9% → 67.5% stmts, 46.6% → 63.9% branch, 50% → 79.2% funcs
- Overall: 37.2% → 40.0% stmts, 43.4% → 56.9% branch, 55.2% → 66.7% funcs
2026-03-24 00:59:41 +00:00