@@ -190,7 +190,7 @@ class DefaultLiveObjectsTest : IntegrationTest() {
190190 assertWaiter { rootMap.size() == 5L } // Wait for the removal to complete
191191 assertNull(rootMap.get(" referencedCounter" )) // Should be null after removal
192192 assertEquals(1 , counterUpdates.size) // Should have received one update for deletion
193- assertEquals(20.0 , counterUpdates[0 ]) // The update should indicate the counter was removed
193+ assertEquals(- 20.0 , counterUpdates[0 ]) // The update should indicate counter was removed with value 20
194194
195195 // Remove the "referencedMap" from the root map
196196 val referencedMap = rootMap.get(" referencedMap" ) as LiveMap
@@ -212,5 +212,28 @@ class DefaultLiveObjectsTest : IntegrationTest() {
212212 assertEquals(1 , updatedMap.size) // Should have one change
213213 assertEquals(" counterKey" , updatedMap.keys.first()) // The change should be for the "counterKey"
214214 assertEquals(LiveMapUpdate .Change .REMOVED , updatedMap.values.first()) // Should indicate removal
215+
216+ // Remove the "valuesMap" from the root map
217+ val valuesMap = rootMap.get(" valuesMap" ) as LiveMap
218+ assertNotNull(valuesMap)
219+ // Subscribe to map updates to verify removal
220+ val valuesMapUpdates = mutableListOf<Map <String , LiveMapUpdate .Change >>()
221+ valuesMap.subscribe { event ->
222+ valuesMapUpdates.add(event.update)
223+ }
224+
225+ // Simulate the deletion of the valuesMap object
226+ channel.objects.simulateObjectDelete(valuesMap as DefaultLiveMap )
227+
228+ assertWaiter { rootMap.size() == 3L } // Wait for the removal to complete
229+ assertNull(rootMap.get(" valuesMap" )) // Should be null after removal
230+ assertEquals(1 , valuesMapUpdates.size) // Should have received one update for deletion
231+
232+ val updatedValuesMap = valuesMapUpdates.first()
233+ assertEquals(13 , updatedValuesMap.size) // Should have 13 changes (one for each entry in valuesMap)
234+ // Verify that all entries in valuesMap were marked as REMOVED
235+ updatedValuesMap.values.forEach { change ->
236+ assertEquals(LiveMapUpdate .Change .REMOVED , change)
237+ }
215238 }
216239}
0 commit comments