From 2f3d035d3c6473daa8ab861c241cd6f999456ec9 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 20 Apr 2026 09:34:48 -0400 Subject: [PATCH] Fixes failing tests due to dispatcher misconfiguration --- .../vitorpamplona/amethyst/commons/call/CallManagerTest.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/call/CallManagerTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/call/CallManagerTest.kt index dfa40002e8..fab6868d6e 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/call/CallManagerTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/call/CallManagerTest.kt @@ -36,6 +36,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.launch import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest @@ -108,13 +109,13 @@ class CallManagerTest { */ private fun TestScope.collectSessionEvents(manager: CallManager): Pair, Job> { val events = mutableListOf() - val job = launch { manager.sessionEvents.collect { events.add(it) } } + val job = launch(UnconfinedTestDispatcher(testScheduler)) { manager.sessionEvents.collect { events.add(it) } } return events to job } private fun TestScope.collectRenegotiationEvents(manager: CallManager): Pair, Job> { val events = mutableListOf() - val job = launch { manager.renegotiationEvents.collect { events.add(it) } } + val job = launch(UnconfinedTestDispatcher(testScheduler)) { manager.renegotiationEvents.collect { events.add(it) } } return events to job }