diff --git a/Assets/Mirror/Tests/Editor/ClientSceneTests.cs b/Assets/Mirror/Tests/Editor/ClientSceneTests.cs index bf52a3a04..63135d9dc 100644 --- a/Assets/Mirror/Tests/Editor/ClientSceneTests.cs +++ b/Assets/Mirror/Tests/Editor/ClientSceneTests.cs @@ -150,6 +150,38 @@ public void UnregisterPrefab_ErrorWhenPrefabHasNoNetworkIdentity() } + [Test] + public void UnregisterSpawnHandler_RemovesSpawnHandlersFromDictionary() + { + spawnHandlers.Add(validPrefabGuid, new SpawnHandlerDelegate(x => null)); + + ClientScene.UnregisterSpawnHandler(validPrefabGuid); + + Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid)); + } + + [Test] + public void UnregisterSpawnHandler_RemovesUnSpawnHandlersFromDictionary() + { + unspawnHandlers.Add(validPrefabGuid, new UnSpawnDelegate(x => { })); + + ClientScene.UnregisterSpawnHandler(validPrefabGuid); + + Assert.IsFalse(unspawnHandlers.ContainsKey(validPrefabGuid)); + } + + [Test] + public void UnregisterSpawnHandler_DoesNotRemovePrefabDictionary() + { + prefabs.Add(validPrefabGuid, validPrefab); + + ClientScene.UnregisterSpawnHandler(validPrefabGuid); + + // Should not be removed + Assert.IsTrue(prefabs.ContainsKey(validPrefabGuid)); + } + + [Test] public void ClearSpawners_RemovesAllPrefabsFromDictionary() {