aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/manager_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-17 22:00:33 -0400
committerhistoria <[not public]>2026-09-17 22:00:33 -0400
commit32a3c59cebf2a16277e54d715a67adfdbe00b456 (patch)
tree9bc87011513ef92f0613d9339fc55689f130915d /internal/casino/manager_test.go
parentfea2cc6839ec3ee17940a2dea69622dc6f4deabf (diff)
downloadthehouseoficarus-32a3c59cebf2a16277e54d715a67adfdbe00b456.tar.gz
fix: exact casino settlement/refund coverage, journal damage handling, craft output ordering, aggregate ingredient planning
Diffstat (limited to 'internal/casino/manager_test.go')
-rw-r--r--internal/casino/manager_test.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/internal/casino/manager_test.go b/internal/casino/manager_test.go
index fa26aa1..b037efa 100644
--- a/internal/casino/manager_test.go
+++ b/internal/casino/manager_test.go
@@ -18,7 +18,7 @@ func (w *testWallet) Wager(amount int) (Wager, error) {
w.chips -= chips
credits := amount - chips
w.credits -= credits
- wager := Wager{Total: amount, Chips: chips, Credits: credits}
+ wager := Wager{Total: amount, Chips: chips, Credits: credits, ID: string(rune('a' + len(w.open)))}
w.open = append(w.open, wager)
return wager, nil
}
@@ -28,6 +28,24 @@ func (w *testWallet) PayCredits(amount int) error {
return nil
}
+// PayStakeCover routes through PayCredits so a wallet rejecting payouts
+// (failingPayoutWallet) rejects stake-covering settlements identically.
+func (w *testWallet) PayStakeCover(amount int, _ []string) error {
+ return w.PayCredits(amount)
+}
+
+// ResolveStake settles one outstanding stake by handle, mirroring the
+// production wallet.
+func (w *testWallet) ResolveStake(stakeID string) {
+ kept := w.open[:0]
+ for _, wager := range w.open {
+ if wager.ID != stakeID {
+ kept = append(kept, wager)
+ }
+ }
+ w.open = kept
+}
+
// ResolveStakes mirrors the production wallet: every outstanding stake is
// settled (no longer refundable).
func (w *testWallet) ResolveStakes() { w.open = nil }