feat: add hand detail API and enrich hand summary fields
- HandSummary: add hole_cards, starting_stacks, ending_stacks, pot_contributions - Engine: capture all players' hole cards (not just showdown), pre/post hand stacks, per-level pot contributions - Server: new GET /game/<game_id>/hands/<hand_number> route - Service: add get_hand_state() method - Tests: add ServerTests for new endpoint, update existing tests - Existing GET /game/<game_id> auto-inherits new fields via shared to_dict()
This commit is contained in:
@@ -40,8 +40,16 @@ class ServiceTests(unittest.TestCase):
|
||||
|
||||
hands = manager.run_hands(game.game_id, count=1)
|
||||
|
||||
state = manager.get_game_state("demo")
|
||||
hand = manager.get_hand_state("demo", 1)
|
||||
|
||||
self.assertEqual(len(hands), 1)
|
||||
self.assertEqual(manager.get_game_state("demo")["hand_number"], 1)
|
||||
self.assertEqual(state["hand_number"], 1)
|
||||
self.assertEqual(hand, state["hands"][0])
|
||||
self.assertIn("hole_cards", hand)
|
||||
self.assertIn("starting_stacks", hand)
|
||||
self.assertIn("ending_stacks", hand)
|
||||
self.assertIn("pot_contributions", hand)
|
||||
|
||||
def test_get_game_state_does_not_block_during_run(self) -> None:
|
||||
manager = GameManager()
|
||||
|
||||
Reference in New Issue
Block a user