Skip to content

Commit dd28a8c

Browse files
committed
test: add comprehensive blind skipping test coverage
- Add test for skipping big blind after playing small blind - Add test for skipping both small and big blinds consecutively - Update test seed to OOOO155 for consistent test runs
1 parent c32afb3 commit dd28a8c

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

tests/test_api_functions.py

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def setup_and_teardown(
182182
"deck": "Red Deck",
183183
"stake": 1,
184184
"challenge": None,
185-
"seed": "EXAMPLE",
185+
"seed": "OOOO155",
186186
}
187187
game_state = send_and_receive_api_message(
188188
udp_client, "start_run", start_run_args
@@ -219,6 +219,70 @@ def test_skip_blind(self, udp_client: socket.socket) -> None:
219219
# Assert that the current blind is "Big", the "Small" blind was skipped
220220
assert game_state["game"]["blind_on_deck"] == "Big"
221221

222+
def test_skip_big_blind(self, udp_client: socket.socket) -> None:
223+
"""Test complete flow: play small blind, cash out, skip shop, skip big blind."""
224+
# 1. Play small blind (select it)
225+
select_blind_args = {"action": "select"}
226+
game_state = send_and_receive_api_message(
227+
udp_client, "skip_or_select_blind", select_blind_args
228+
)
229+
230+
# Verify we're in hand selection state
231+
assert game_state["state"] == State.SELECTING_HAND.value
232+
233+
# 2. Play winning hand (four of a kind)
234+
play_hand_args = {"action": "play_hand", "cards": [0, 1, 2, 3]}
235+
game_state = send_and_receive_api_message(
236+
udp_client, "play_hand_or_discard", play_hand_args
237+
)
238+
239+
# Verify we're in round evaluation state
240+
assert game_state["state"] == State.ROUND_EVAL.value
241+
242+
# 3. Cash out to go to shop
243+
game_state = send_and_receive_api_message(udp_client, "cash_out", {})
244+
245+
# Verify we're in shop state
246+
assert game_state["state"] == State.SHOP.value
247+
248+
# 4. Skip shop (next round)
249+
game_state = send_and_receive_api_message(
250+
udp_client, "shop", {"action": "next_round"}
251+
)
252+
253+
# Verify we're back in blind selection state
254+
assert game_state["state"] == State.BLIND_SELECT.value
255+
256+
# 5. Skip the big blind
257+
skip_big_blind_args = {"action": "skip"}
258+
game_state = send_and_receive_api_message(
259+
udp_client, "skip_or_select_blind", skip_big_blind_args
260+
)
261+
262+
# Verify we successfully skipped the big blind and are still in blind selection
263+
assert game_state["state"] == State.BLIND_SELECT.value
264+
265+
def test_skip_both_blinds(self, udp_client: socket.socket) -> None:
266+
"""Test skipping small blind then immediately skipping big blind."""
267+
# 1. Skip the small blind
268+
skip_small_args = {"action": "skip"}
269+
game_state = send_and_receive_api_message(
270+
udp_client, "skip_or_select_blind", skip_small_args
271+
)
272+
273+
# Verify we're still in blind selection and the big blind is on deck
274+
assert game_state["state"] == State.BLIND_SELECT.value
275+
assert game_state["game"]["blind_on_deck"] == "Big"
276+
277+
# 2. Skip the big blind
278+
skip_big_args = {"action": "skip"}
279+
game_state = send_and_receive_api_message(
280+
udp_client, "skip_or_select_blind", skip_big_args
281+
)
282+
283+
# Verify we successfully skipped both blinds
284+
assert game_state["state"] == State.BLIND_SELECT.value
285+
222286
def test_invalid_blind_action(self, udp_client: socket.socket) -> None:
223287
"""Test that invalid blind action arguments are handled properly."""
224288
# Should receive error response

0 commit comments

Comments
 (0)