aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/polish_refund_forfeit_test.go
blob: 1408fcd802427bccbf389befa237255b433911b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
	}
}