Skip to content

Add Vitest unit suite for the deterministic lib layer#1

Merged
Sarthak195 merged 1 commit into
mainfrom
add-vitest-suite
Jul 15, 2026
Merged

Add Vitest unit suite for the deterministic lib layer#1
Sarthak195 merged 1 commit into
mainfrom
add-vitest-suite

Conversation

@Sarthak195

Copy link
Copy Markdown
Owner

Why

Testing scored 0/100 in judging because the project had no test infrastructure at all — no runner, no config, no test files. This addresses that directly.

What

  • Wire up Vitest (node environment, @/ alias mirrored from tsconfig) with npm test / test:watch / test:coverage scripts.
  • 43 tests colocated as *.test.ts, covering the pure, network-free src/lib layer:
Module Coverage
simulator/detector.ts — density/queue/medical/storm rules, dedup, severity mapping, id sequencing 100%
predict.ts — trend projection, breached/flat/falling suppression, ETA horizon bounds, gate-plaza exclusion, ordering 96%
traffic/model.ts — arrival peak vs. quiet mid-match vs. egress advisories, determinism, seed jitter 98%
tournament.ts — offset→phase mapping, clamped local minute, fill/density bounds 100%
store.ts — id assignment, pending default, status override, 200-task cap 100%
weather/client.ts — deterministic fallback, summary formatting, live-response mapping + both network-failure fallbacks (mocked fetch) 81%
  • Ignore /coverage, document the suite in CLAUDE.md.

Uncovered files (useMatchStream, live.ts, gemini.ts, theme.ts) are DOM/network/SSE/Gemini surfaces — intentionally out of scope for unit tests.

Verification

  • npm test43 passed
  • npm run typecheck → clean (tsc now includes the test files)

Testing scored 0 in judging because there was no test infrastructure.
Wire up Vitest (node env, @/ alias mirrored from tsconfig) and add 43
tests colocated as *.test.ts covering the pure, network-free modules:

- simulator/detector: density/queue/medical/storm rules, dedup behavior,
  severity mapping, id sequencing
- predict: trend projection, breached/flat/falling suppression, ETA
  horizon bounds, gate-plaza exclusion, ordering
- traffic/model: arrival peak vs. quiet mid-match vs. egress advisories,
  determinism, seed jitter
- tournament: offset->phase mapping, clamped local minute, fill/density bounds
- store: id assignment, pending default, status override, 200-task cap
- weather/client: deterministic fallback, summary formatting, live-response
  mapping and both network-failure fallbacks (mocked fetch)

Add npm test / test:watch / test:coverage scripts, ignore /coverage,
document the suite in CLAUDE.md.
@Sarthak195
Sarthak195 merged commit 3dc9c11 into main Jul 15, 2026
1 check passed
@Sarthak195
Sarthak195 deleted the add-vitest-suite branch July 15, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant