diff options
| author | historia <[not public]> | 2026-09-16 14:41:15 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-16 14:41:15 -0400 |
| commit | 9192d94dea6be5498ab080f3e2df5667af871d7a (patch) | |
| tree | e7aef3089d5d1e8da686c6b6ca9d4faeacb8b20b /internal/admin/api_rooms_casino_evict_test.go | |
| parent | 2f34e75f27e5f99cfc1c5f8eaf6ab4ff2fddb1d9 (diff) | |
| download | thehouseoficarus-9192d94dea6be5498ab080f3e2df5667af871d7a.tar.gz | |
fix: casino room eviction, session close race fix, open-payout recovery evidence
Diffstat (limited to 'internal/admin/api_rooms_casino_evict_test.go')
| -rw-r--r-- | internal/admin/api_rooms_casino_evict_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/admin/api_rooms_casino_evict_test.go b/internal/admin/api_rooms_casino_evict_test.go new file mode 100644 index 0000000..426c13a --- /dev/null +++ b/internal/admin/api_rooms_casino_evict_test.go @@ -0,0 +1,27 @@ +package admin + +// Regression: deleting a single room through the editor API must evict the +// room's cached casino games and refund their outstanding wagers, exactly +// like the bulk-delete path does. Skipping eviction strands seated players' +// wagers in games whose room no longer exists. + +import ( + "net/http" + "net/http/httptest" + "testing" +) + +func TestRoomDeleteEvictsCasinoGames(t *testing.T) { + s := newTestAdminServer(t, map[int]string{1: "id: 1\nname: Room\n"}) + var evicted []int + s.evictRoom = func(id int) { evicted = append(evicted, id) } + + rec := httptest.NewRecorder() + s.handleRoomByID(rec, httptest.NewRequest(http.MethodDelete, "/api/rooms/1", nil)) + if _, ok := s.world.GetRoomPath(1); ok { + t.Fatalf("room was not removed: %s", rec.Body.String()) + } + if len(evicted) != 1 || evicted[0] != 1 { + t.Fatalf("room deletion evicted %v, want [1] (outstanding wagers were not resolved)", evicted) + } +} |
