diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/casino/manager_test.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/casino/manager_test.go')
| -rw-r--r-- | internal/casino/manager_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
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) |
