aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/polish_refund_forfeit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/polish_refund_forfeit_test.go')
-rw-r--r--internal/casino/polish_refund_forfeit_test.go24
1 files changed, 24 insertions, 0 deletions
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)
+ }
+}