diff --git a/internal/web/games_play_test.go b/internal/web/games_play_test.go index e7d81cd..02603c1 100644 --- a/internal/web/games_play_test.go +++ b/internal/web/games_play_test.go @@ -93,9 +93,6 @@ func TestDealTakesTheStakeAndHidesTheHoleCard(t *testing.T) { if code != 200 { t.Fatalf("deal = %d, want 200", code) } - if v.Chips != 900 { - t.Fatalf("chips after a 100 bet = %d, want 900", v.Chips) - } if v.Hand == nil { t.Fatal("deal returned no hand") } @@ -103,10 +100,18 @@ func TestDealTakesTheStakeAndHidesTheHoleCard(t *testing.T) { t.Fatalf("player was dealt %d cards, want 2", len(v.Hand.Hands[0].Cards)) } - // A natural settles on the spot and legitimately shows both dealer cards. + // A natural settles on the spot: the stake has already come back (with the + // win, or as a push), and both dealer cards are legitimately shown. Checking + // the stack for 900 before this made the test fail on every dealt natural. if v.Hand.Phase == "done" { + if v.Chips < 900 { + t.Fatalf("chips after a settled natural = %d, want at least the 900 left after the bet", v.Chips) + } return } + if v.Chips != 900 { + t.Fatalf("chips after a 100 bet = %d, want 900", v.Chips) + } if !v.Hand.Hole || len(v.Hand.Dealer) != 1 { t.Fatalf("dealer shows %d cards (hole=%v), want 1 with the hole card held back", len(v.Hand.Dealer), v.Hand.Hole)