From 08269639606c0481037cbde7ebaf2e0455460883 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 18:43:09 +0100 Subject: v2.2.1: forfeit blackjack bets when leaving or disconnecting --- tests/client_core.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests/client_core.rs') diff --git a/tests/client_core.rs b/tests/client_core.rs index cfcf608..ec444bd 100644 --- a/tests/client_core.rs +++ b/tests/client_core.rs @@ -722,6 +722,7 @@ fn blackjack_deals_hits_and_settles() { assert!(h.board()[3].contains("You: [10♠] [6♥] 16")); assert!(h.board()[4].contains("Hit, stand or double.")); assert!(h.board()[5].contains("[D]ouble")); + assert!(h.board()[5].contains("[Q] Forfeit")); h.key(Key::Char('h')); assert_eq!( @@ -757,7 +758,7 @@ fn blackjack_deals_hits_and_settles() { } #[test] -fn blackjack_cancel_sends_a_cancel_action() { +fn blackjack_forfeit_is_sent_when_leaving_an_active_hand() { let mut h = Harness::new(); h.enter_blackjack(); h.key(Key::Char(' ')); @@ -784,10 +785,10 @@ fn blackjack_cancel_sends_a_cancel_action() { h.key(Key::Char('q')); assert_eq!( h.sent.last().map(String::as_str), - Some("BLACKJACK_ACTION bj1 cancel") + Some("BLACKJACK_ACTION bj1 forfeit") ); - let cancelled = bj_state( + let forfeited = bj_state( "bj1", "done", &["10S", "6H"], @@ -796,18 +797,22 @@ fn blackjack_cancel_sends_a_cancel_action() { 9, 10, 10, - 1000, + 990, &[], - "cancelled", + "forfeit", 0, ); h.reply(&format!( "BLACKJACK_STATE {}", - serde_json::to_string(&cancelled).unwrap() + serde_json::to_string(&forfeited).unwrap() )); assert!(h.board().is_empty()); - assert!(h.screen.lines.iter().any(|line| line == "Game exited.")); + assert!(h + .screen + .lines + .iter() + .any(|line| line.contains("forfeited (10 PLN lost)"))); } #[test] -- cgit v1.2.3