mirror of
https://github.com/kuhyx/testsAndMisc-archive.git
synced 2026-11-10 19:07:06 +01:00
Removes the last fixable non-null assertion. GamePhase goes from a string union to a tagged one whose "done" arm carries `result: GameResult`, so narrowing on phase.kind yields a non-null result and `fileResult!` disappears. GameResult - previously an untagged union nothing consumed - is now tagged, so the render picks a screen from the discriminant instead of inferring it from which of two nullable states was set. Three earlier attempts at this site were reverted: a null guard returning null, a widened ReactElement | null return, and a tagged GameResult with phase left as a string. Each either added a branch no test could reach - dropping the 100% gate - or left the value nullable in the fall-through. The invariant lived in the phase, so the fix had to as well. Coverage stays 100%. Statements 585 -> 579 and lines 536 -> 530, exactly the two useState declarations and their setters that the collapse removed; branches unchanged at 217, so nothing new went untested. All 10 App tests pass unmodified - they drive the app through mocked onDone callbacks, so both done arms are exercised through the new union. eslint 5 -> 4 (45 -> 4 for the session). The remaining four are reported in the previous commit's evidence. usePuzzleGameLoop's Map.get assertion is not among the fixable ones: `?? Infinity` was tried and measured at 219 branches / 99.54%, since the default side is unreachable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY |
||
|---|---|---|
| bucket_catch | ||