From 516fd29da423432ef6dfded21a984f1d15dcab1a Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 5 Oct 2026 17:31:50 -0400 Subject: fix: slop casino and economy fixes --- internal/casino/machine_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/casino/machine_test.go') diff --git a/internal/casino/machine_test.go b/internal/casino/machine_test.go index 1e8cdad..8942936 100644 --- a/internal/casino/machine_test.go +++ b/internal/casino/machine_test.go @@ -14,6 +14,20 @@ func TestBetRangeTextFormatsUnlimitedMax(t *testing.T) { } } +// Regression: standing up while a feature was banked silently dropped the +// credits; leave must settle them like markDisconnected does. +func TestMachineLeavePaysBankedFeature(t *testing.T) { + m := newMachine(1, MachineConfig{ID: "slots", Game: GameSlots}, rand.New(rand.NewSource(7))) + w := &testWallet{} + m.player = &Participant{Name: "alice", Connected: true, Wallet: w} + m.featureBank = 25 + m.phase = machineReady + _ = m.leave("alice") + if w.paid != 25 { + t.Fatalf("banked feature not paid on leave: paid = %d, want 25", w.paid) + } +} + func TestMachineSetBetUnsetDefaultMaxMessage(t *testing.T) { m := newMachine(1, MachineConfig{ID: "slots", Game: GameSlots, MinBet: 1}, rand.New(rand.NewSource(7))) m.player = &Participant{Name: "alice", Connected: true} -- cgit v1.2.3