diff options
Diffstat (limited to 'internal/casino/pai_gow_test.go')
| -rw-r--r-- | internal/casino/pai_gow_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/casino/pai_gow_test.go b/internal/casino/pai_gow_test.go index 7be9e8a..100b87d 100644 --- a/internal/casino/pai_gow_test.go +++ b/internal/casino/pai_gow_test.go @@ -838,3 +838,31 @@ func TestPaiGowBettingWindowTimeoutNotifiesNonBettor(t *testing.T) { t.Fatal("non-bettor was not told the betting window closed") } } + +// Regression: with one bettor and one idle seated player the betting window +// must still close. activePlayersLocked counts bettors, so it used to stay at 1 +// forever and the round stalled until the idle seat bet or left. +func TestPaiGowBettingWindowExpiresWithOneBettorAndIdleSeat(t *testing.T) { + tab := pgTestTable(false) // BettingTicks 2 + w := &testWallet{chips: 100} + tab.join("a") + tab.join("b") + tab.bet("a", "main", 10, w) + if tab.phase != "betting" { + t.Fatalf("setup: wanted betting, got %s", tab.phase) + } + notified := false + for i := 0; i < 4; i++ { + for _, e := range tab.tick() { + if e.PrivateTo == "b" && strings.Contains(e.Message, "betting window closed") { + notified = true + } + } + } + if tab.phase == "betting" { + t.Fatal("round stalled in betting with one bettor and one idle seat") + } + if !notified { + t.Fatal("idle seat was not sat out when the window closed") + } +} |
