package casino import "testing" // Regression: refundAll's comment claimed a failed refund kept featureBank in // memory, but resetSeat zeroes it before the settlement switch runs, so // already-landed free-spin winnings are forfeited. The forfeiture must be // reported explicitly rather than dropped silently. func TestMachineRefundAllReportsForfeitedBankOnFailedRefund(t *testing.T) { m := newMachine(1, MachineConfig{ID: "slots", Game: GameSlots}, newTestRand()) wallet := &failingRefundWallet{testWallet{credits: 100}} m.join("alice") m.beginSpinLocked(10, wallet, "", "") m.featureBank = 25 events := m.refundAll() if m.featureBank != 0 { t.Fatalf("featureBank = %v after refundAll, want 0 (resetSeat cleared it)", m.featureBank) } if !hasMessage(events, "forfeited") { t.Fatalf("the forfeited bank was not reported: %+v", events) } }