diff options
Diffstat (limited to 'internal/casino/table_ux_test.go')
| -rw-r--r-- | internal/casino/table_ux_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/casino/table_ux_test.go b/internal/casino/table_ux_test.go index 7f93951..812bed0 100644 --- a/internal/casino/table_ux_test.go +++ b/internal/casino/table_ux_test.go @@ -161,6 +161,38 @@ func TestSplitAndInsuranceRoundNetIncludesEveryStake(t *testing.T) { } } +func TestSingleHandSettlementKeepsSummaryQuiet(t *testing.T) { + // A connected player with one hand and no insurance already saw the net in + // the per-hand result; the next bet menu carries the balance. + table := uxBlackjack() + table.dealer.cards = []card{{rank: "10", suit: "spades"}, {rank: "7", suit: "hearts"}} + events := table.settle() + if hasMessage(events, "Round complete") { + t.Fatalf("single-hand settlement repeated the net: %+v", events) + } + for _, e := range events { + if e.ShowBalance { + t.Fatalf("balance attached to a settlement whose next menu carries it: %+v", e) + } + } +} + +func TestDepartingSettlementCarriesBalanceSummary(t *testing.T) { + table := uxBlackjack() + table.dealer.cards = []card{{rank: "10", suit: "spades"}, {rank: "7", suit: "hearts"}} + table.players.get("alice").LeaveAfter = true + events := table.settle() + found := false + for _, e := range events { + if strings.Contains(e.Message, "Round complete") && e.ShowBalance { + found = true + } + } + if !found { + t.Fatalf("departing player lost the balance summary: %+v", events) + } +} + func TestRebetMenusAndMidRoundJoin(t *testing.T) { table := uxBlackjack() events := table.join("bob") |
