Skip to content

test(game): coverage gate for decomposed Game modules (Phase 8 of #134) - #143

Merged
nodots merged 1 commit into
refactor/game-decomp-phase7-facadefrom
refactor/game-decomp-phase8-coverage
Jul 15, 2026
Merged

test(game): coverage gate for decomposed Game modules (Phase 8 of #134)#143
nodots merged 1 commit into
refactor/game-decomp-phase7-facadefrom
refactor/game-decomp-phase8-coverage

Conversation

@nodots

@nodots nodots commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Phase 8 of the epic (#133) — coverage gate (#134)

Stacked on #142 (Phase 7). Retarget to development as parents merge.

Adds targeted tests for the decomposed Game/ modules plus a COVERAGE=1-gated threshold scoped to src/Game/.

Coverage added

Module Before After (stmt/branch)
guards.ts 27% 100% / 100%
robot.ts 25% 88% / 88%
cube.ts 88% / 70% 93% / 76%
facade index.ts 62% / 42% 81% / 61%
turnFlow.ts 44% / 30% 76% / 66%

src/Game/ aggregate: ~59% → 80.5% stmts, 71.8% branch, 89% funcs, 82.5% lines.

The gate

coverageThreshold: {
  './src/Game/': { statements: 75, functions: 75, lines: 75, branches: 70 },
}
  • Directory-path key → aggregate across src/Game/ (not per-file), so well-covered modules balance the thin executeRobotTurn delegator and the large turnFlow.
  • Enforced only under COVERAGE=1 (the CI coverage job); normal jest runs are unaffected.
  • Branch floor is 70 (just under the current 71.8% aggregate) and ratchets toward 75 as the remaining turnFlow no-move/blocked paths and the gnuPositionId getter gain coverage — per the "ratchet up, don't jump" plan.

Verification

  • COVERAGE=1 npx jest: exit 0, gate satisfied
  • npx jest: 518 passed / 12 skipped, exit 0

Follow-up

Branch → 75 needs blocked-board fixtures for roll's no-move transitions and a new Game() fixture for the gnuPositionId getter; deferred so the gate can land now.

Refs #134

Add targeted tests for the decomposed modules and a COVERAGE=1-gated
threshold scoped to src/Game/:
- guards.ts -> 100% (canRoll/canRollForStart/canPlayerRoll/canGetPossibleMoves)
- robot.ts -> 88% (handleRobotMovedState, confirmTurnWithRobotAutomation)
- game-accessors: activePlayer/inactivePlayer/getPlayersForColor/findChecker + createNewGame rules merge
- turnFlow: roll (rolled-for-start/rolling/doubled), switchDice, executeAndRecalculate, checkAndCompleteTurn, toMoved, moveAndFinalize
- cube: acceptDouble-at-64 (maxxed) and refuseDouble non-first-double

Game/ aggregate coverage: ~59% -> 80.5% stmts, 71.8% branch, 89% funcs,
82.5% lines. Gate uses a directory-path key (aggregate, not per-file) at
75/70/75/75; branch floor ratchets toward 75 as turnFlow no-move/blocked
paths and the gnuPositionId getter gain coverage. Enforced only under
COVERAGE=1, so normal jest runs are unaffected.

Core: 518 passed / 12 skipped; COVERAGE=1 exit 0; normal exit 0.

Refs #134
@nodots
nodots merged commit 389ad04 into refactor/game-decomp-phase7-facade Jul 15, 2026
@nodots
nodots deleted the refactor/game-decomp-phase8-coverage branch July 15, 2026 18:37
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