From 153acb7f644d755c45533b7c5311e3ffa47e8973 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 05:31:09 -0400 Subject: fix: harden engine across casino, economy, concurrency, security, and content --- internal/casino/polish_refund_forfeit_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/casino/polish_refund_forfeit_test.go (limited to 'internal/casino/polish_refund_forfeit_test.go') diff --git a/internal/casino/polish_refund_forfeit_test.go b/internal/casino/polish_refund_forfeit_test.go new file mode 100644 index 0000000..1408fcd --- /dev/null +++ b/internal/casino/polish_refund_forfeit_test.go @@ -0,0 +1,24 @@ +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) + } +} -- cgit v1.2.3