aboutsummaryrefslogtreecommitdiff
path: root/internal/game/economy_shutdown_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/economy_shutdown_test.go')
-rw-r--r--internal/game/economy_shutdown_test.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/internal/game/economy_shutdown_test.go b/internal/game/economy_shutdown_test.go
index bd6c253..a3e6adb 100644
--- a/internal/game/economy_shutdown_test.go
+++ b/internal/game/economy_shutdown_test.go
@@ -101,9 +101,19 @@ func TestEconomyWagerDebitsDurallyAndSettles(t *testing.T) {
if p.Credits != 90 {
t.Fatalf("credits after wager = %d, want 90", p.Credits)
}
- // The journal must show the record settled (debit is durable).
- if open := h.g.Economy.loadOpen(); len(open) != 0 {
- t.Fatalf("open records remain after a successful wager: %v", open)
+ // The debit is durable, and the record stays OPEN: the stake is
+ // outstanding until the round resolves (recovery refunds open stakes
+ // after a crash).
+ if open := h.g.Economy.openStakes("alice"); len(open) != 1 || open[0].Credit != 10 {
+ t.Fatalf("outstanding stake after a successful wager: %+v", open)
+ }
+ // Resolution (round resolved or refunded) closes it.
+ h.g.RunOnOwner(func() {
+ w.ResolveStakes()
+ })
+ h.barrier()
+ if open := h.g.Economy.openStakes("alice"); len(open) != 0 {
+ t.Fatalf("open stakes remain after resolution: %v", open)
}
}