aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/blackjack_split_regression_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-16 21:35:55 -0400
committerhistoria <[not public]>2026-09-16 21:35:55 -0400
commitfea2cc6839ec3ee17940a2dea69622dc6f4deabf (patch)
tree9d893525ca20d2cc920e9e866f84f71b605d8ae9 /internal/casino/blackjack_split_regression_test.go
parent35ddd0ad2215760bb1d3dc7724480f179ea33fa6 (diff)
downloadthehouseoficarus-fea2cc6839ec3ee17940a2dea69622dc6f4deabf.tar.gz
fix: unify crafting ingredient resolution; fix superheat alternatives, quantity gates, and dropped combine byproducts
Diffstat (limited to 'internal/casino/blackjack_split_regression_test.go')
-rw-r--r--internal/casino/blackjack_split_regression_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/casino/blackjack_split_regression_test.go b/internal/casino/blackjack_split_regression_test.go
new file mode 100644
index 0000000..1674d40
--- /dev/null
+++ b/internal/casino/blackjack_split_regression_test.go
@@ -0,0 +1,36 @@
+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]))
+ }
+}