diff options
| author | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
| commit | 153acb7f644d755c45533b7c5311e3ffa47e8973 (patch) | |
| tree | 7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/casino/polish_refund_forfeit_test.go | |
| parent | 87d08f0151e643951769e323995f1c5ed89ee200 (diff) | |
| download | thehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz | |
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/casino/polish_refund_forfeit_test.go')
| -rw-r--r-- | internal/casino/polish_refund_forfeit_test.go | 24 |
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) + } +} |
