-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
Add comprehensive tests for the new hasValuableMoves() function and verify its integration with the game-over detection flow.
Tests to Add
Unit tests for hasValuableMoves (in BeleagueredCastleRules.test.ts)
-
Board with only non-valuable moves detects as game-over: Construct a state where the only legal moves are tableau-to-tableau shuffles that don't expose new cards. Verify
hasValuableMoves()returns false. -
Board with at least one valuable move is NOT game-over: Construct a state where at least one move exposes a new card or creates a new foundation opportunity. Verify
hasValuableMoves()returns true. -
Foundation move is always valuable: A state where the only legal move is a tableau-to-foundation move. Should return true.
-
Empty tableau columns: Edge case where some columns are empty but moves between remaining columns don't help.
-
Single-card columns: State with single-card columns where moves expose the empty column (which is a new move target).
-
No legal moves at all: Verify returns false (consistent with hasNoMoves).
-
Fresh deal has valuable moves: A normal deal should always have at least one valuable move.
-
State is not mutated: Verify the state is identical before and after calling hasValuableMoves.
Integration tests (in Integration.test.ts)
- Full game detects stuck state: Play a game that reaches a stuck position and verify the game ends appropriately.
Acceptance Criteria
- All listed test cases are implemented and pass
- All existing tests continue to pass
- Tests cover the key edge cases from the parent work item's AC