@@ -231,6 +231,21 @@ def test_invalid_blind_action(self, udp_client: socket.socket) -> None:
231231 error_response , "Invalid action arg for skip_or_select_blind" , ["action" ]
232232 )
233233
234+ def test_skip_or_select_blind_invalid_state (self , udp_client : socket .socket ) -> None :
235+ """Test that skip_or_select_blind returns error when not in blind selection state."""
236+ # Go to menu to ensure we're not in blind selection state
237+ send_and_receive_api_message (udp_client , "go_to_menu" , {})
238+
239+ # Try to select blind when not in blind selection state
240+ error_response = send_and_receive_api_message (
241+ udp_client , "skip_or_select_blind" , {"action" : "select" }
242+ )
243+
244+ # Verify error response
245+ assert_error_response (
246+ error_response , "Cannot skip or select blind when not in blind selection" , ["current_state" ]
247+ )
248+
234249
235250class TestPlayHandOrDiscard :
236251 """Tests for the play_hand_or_discard API endpoint."""
@@ -407,6 +422,21 @@ def test_try_to_discard_when_no_discards_left(
407422 response , "No discards left to perform discard" , ["discards_left" ]
408423 )
409424
425+ def test_play_hand_or_discard_invalid_state (self , udp_client : socket .socket ) -> None :
426+ """Test that play_hand_or_discard returns error when not in selecting hand state."""
427+ # Go to menu to ensure we're not in selecting hand state
428+ send_and_receive_api_message (udp_client , "go_to_menu" , {})
429+
430+ # Try to play hand when not in selecting hand state
431+ error_response = send_and_receive_api_message (
432+ udp_client , "play_hand_or_discard" , {"action" : "play_hand" , "cards" : [0 , 1 , 2 , 3 , 4 ]}
433+ )
434+
435+ # Verify error response
436+ assert_error_response (
437+ error_response , "Cannot play hand or discard when not selecting hand" , ["current_state" ]
438+ )
439+
410440
411441class TestCashOut :
412442 """Tests for the cash_out API endpoint."""
0 commit comments