diff options
| author | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
| commit | 1f118d79e319da4e765502e9ca5b661772de94f1 (patch) | |
| tree | bca8a3fd1e538f1c302480511e6ba872c92e10b8 /internal/game/sys_safespot_state_test.go | |
| parent | 5ad42a51df4dcc5ccc3aa6a6d902085ce2ee4239 (diff) | |
| download | thehouseoficarus-1f118d79e319da4e765502e9ca5b661772de94f1.tar.gz | |
refactor: casino table core; fix: stake/migration/validation gaps
Diffstat (limited to 'internal/game/sys_safespot_state_test.go')
| -rw-r--r-- | internal/game/sys_safespot_state_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/game/sys_safespot_state_test.go b/internal/game/sys_safespot_state_test.go new file mode 100644 index 0000000..2976bce --- /dev/null +++ b/internal/game/sys_safespot_state_test.go @@ -0,0 +1,19 @@ +package game + +import "testing" + +// TestSafespotManagerRekeyRooms: a live room rename must remap the room ID +// stored on an active safespot, or the safespot lookup misses and the player +// is force-ejected from cover. +func TestSafespotManagerRekeyRooms(t *testing.T) { + m := NewSafespotManager() + m.Set("alice", SafespotState{Active: true, ObjectDefID: "bush", RoomID: 5}) + m.Set("bob", SafespotState{Active: true, ObjectDefID: "rock", RoomID: 9}) + m.RekeyRooms(map[int]int{5: 7}) + if ss, _ := m.Get("alice"); ss.RoomID != 7 { + t.Fatalf("alice safespot room = %d, want 7", ss.RoomID) + } + if ss, _ := m.Get("bob"); ss.RoomID != 9 { + t.Fatalf("bob safespot room = %d, want 9 (unchanged)", ss.RoomID) + } +} |
