package casino // Regression: a non-ace split can draw to 21 on the first hand (K,K splits // into A+K). finishHand must skip that complete hand instead of prompting it, // which offered hit/double on an unplayable 21 and stalled the round until // the action timer fired. import "testing" func TestBlackjackSplitTwentyOneAdvancesToNextHand(t *testing.T) { table := newBlackjackTable(1, TableConfig{ID: "blackjack", Game: GameBlackjack}, newTestRand()) wallet := &testWallet{credits: 100} table.join("alice") // Dealer 17; player K,K; the split draws A (hand one) and 5 (hand two). table.shoe = tableauShoe( card{rank: "10"}, card{rank: "7"}, card{rank: "K"}, card{rank: "K"}, card{rank: "A"}, card{rank: "5"}, card{rank: "2"}, ) table.shoe.shuffleAt = 0 table.bet("alice", "", 10, wallet) if events := table.action("alice", "split"); len(events) == 0 { t.Fatal("split produced no events") } p := table.players.get("alice") if len(p.hands) != 2 { t.Fatalf("split failed: %+v", p.hands) } if total, _ := p.hands[0].total(); total != 21 { t.Fatalf("fixture: first split hand totals %d, want 21", total) } if table.activeHand != 1 { t.Fatalf("split 21 stayed active (hand %d, actions %v); the turn must advance to the second hand", table.activeHand, table.availableActions(p, p.hands[table.activeHand])) } }