Add Vitest unit suite for the deterministic lib layer#1
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
nodeenvironment,@/alias mirrored fromtsconfig) withnpm test/test:watch/test:coveragescripts.*.test.ts, covering the pure, network-freesrc/liblayer:simulator/detector.ts— density/queue/medical/storm rules, dedup, severity mapping, id sequencingpredict.ts— trend projection, breached/flat/falling suppression, ETA horizon bounds, gate-plaza exclusion, orderingtraffic/model.ts— arrival peak vs. quiet mid-match vs. egress advisories, determinism, seed jittertournament.ts— offset→phase mapping, clamped local minute, fill/density boundsstore.ts— id assignment, pending default, status override, 200-task capweather/client.ts— deterministic fallback, summary formatting, live-response mapping + both network-failure fallbacks (mocked fetch)/coverage, document the suite inCLAUDE.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 test→ 43 passednpm run typecheck→ clean (tsc now includes the test files)