diff options
| author | historia <[not public]> | 2026-09-15 19:55:21 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-15 19:55:21 -0400 |
| commit | 6f3c43aca62a7d33a19f14f6ad7c16891952673a (patch) | |
| tree | 0b0665ef624ef442df87ec7131129aaecc3420bd /internal/game/economy_shutdown_test.go | |
| parent | cd95de60364aba8f5bdf8ec86f7234a9903eacc8 (diff) | |
| download | thehouseoficarus-6f3c43aca62a7d33a19f14f6ad7c16891952673a.tar.gz | |
fix: outstanding-stake ledger, owner backpressure, editor state preservation
Diffstat (limited to 'internal/game/economy_shutdown_test.go')
| -rw-r--r-- | internal/game/economy_shutdown_test.go | 16 |
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) } } |
