From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/casino/manager_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'internal/casino/manager_test.go') diff --git a/internal/casino/manager_test.go b/internal/casino/manager_test.go index 889618c..1e77b0b 100644 --- a/internal/casino/manager_test.go +++ b/internal/casino/manager_test.go @@ -74,6 +74,29 @@ func (w *testWallet) RefundOutstanding() (chips, credits int, err error) { return chips, credits, nil } +// RefundStakes returns the named outstanding stakes to the balances in kind, +// mirroring the production wallet's take-back path. +func (w *testWallet) RefundStakes(stakeIDs ...string) error { + wanted := make(map[string]bool, len(stakeIDs)) + for _, id := range stakeIDs { + wanted[id] = true + } + var chips, credits int + kept := w.open[:0] + for _, wager := range w.open { + if wanted[wager.ID] { + chips += wager.Chips + credits += wager.Credits + continue + } + kept = append(kept, wager) + } + w.open = kept + w.chips += chips + w.paid += credits + return nil +} + func TestMixedWagerUsesChipsFirst(t *testing.T) { w := &testWallet{chips: 7, credits: 50} wager, err := w.Wager(12) -- cgit v1.2.3