strat-gameplay-webapp/frontend-sba/tests/unit/components/Game/fix-tests.js
Cal Corum defa06653d CLAUDE: Add interactive x-check workflow foundation (steps 1-5)
Backend changes:
- Add PendingXCheck model for interactive x-check state
- Extend decision_phase/pending_decision validators with 4 new phases
- Add initiate_x_check() to roll dice and present chart to player
- Add submit_x_check_result() to process player selection
- Add resolve_x_check_from_selection() to resolve from player input
- Add WebSocket handlers for x-check workflow
- Modify resolve_manual_play() to route X_CHECK to interactive flow
- All 986 unit tests passing

Frontend changes:
- Extend DecisionPhase type with x-check/DECIDE phases
- Add XCheckData, DecideAdvanceData, DecideThrowData, DecideSpeedCheckData interfaces
- Add PendingXCheck to GameState
- Add 4 new client→server WebSocket events

Next: Implement XCheckWizard component and GameplayPanel integration

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2026-02-07 17:21:19 -06:00

64 lines
1.7 KiB
JavaScript

const fs = require('fs');
// Read RunnerCard.spec.ts
let content = fs.readFileSync('RunnerCard.spec.ts', 'utf8');
// Replace all gameStore.setLineup calls with proper setup
content = content.replace(/gameStore\.setLineup\('home',/g, `gameStore.setGameState({
id: 1,
home_team_id: 1,
away_team_id: 2,
status: 'active',
inning: 1,
half: 'top',
outs: 0,
home_score: 0,
away_score: 0,
home_team_abbrev: 'NYY',
away_team_abbrev: 'BOS',
home_team_dice_color: '3b82f6',
current_batter: null,
current_pitcher: null,
on_first: null,
on_second: null,
on_third: null,
decision_phase: 'idle',
play_count: 0
});
gameStore.updateLineup(1,`);
fs.writeFileSync('RunnerCard.spec.ts', content);
// Read RunnersOnBase.spec.ts
content = fs.readFileSync('RunnersOnBase.spec.ts', 'utf8');
// Replace all gameStore.setLineup calls
content = content.replace(/gameStore\.setLineup\('home',/g, `gameStore.setGameState({
id: 1,
home_team_id: 1,
away_team_id: 2,
status: 'active',
inning: 1,
half: 'top',
outs: 0,
home_score: 0,
away_score: 0,
home_team_abbrev: 'NYY',
away_team_abbrev: 'BOS',
home_team_dice_color: '3b82f6',
current_batter: null,
current_pitcher: null,
on_first: null,
on_second: null,
on_third: null,
decision_phase: 'idle',
play_count: 0
});
gameStore.updateLineup(1,`);
fs.writeFileSync('RunnersOnBase.spec.ts', content);
console.log('Fixed test files');