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) } }