Use backgroundScope
This commit is contained in:
committed by
Benoit Marty
parent
2a4726e611
commit
08673f44ce
@@ -24,9 +24,7 @@ import io.element.android.libraries.push.test.notifications.FakeImageLoaderHolde
|
||||
import io.element.android.services.appnavstate.test.FakeAppNavigationStateService
|
||||
import io.element.android.tests.testutils.lambda.lambdaRecorder
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.test.runCurrent
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -39,7 +37,6 @@ class DefaultOnMissedCallNotificationHandlerTest {
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@Test
|
||||
fun `addMissedCallNotification - should add missed call notification`() = runTest {
|
||||
val childScope = CoroutineScope(coroutineContext + SupervisorJob())
|
||||
val dataFactory = FakeNotificationDataFactory(
|
||||
messageEventToNotificationsResult = lambdaRecorder { _, _, _ -> emptyList() }
|
||||
)
|
||||
@@ -59,7 +56,7 @@ class DefaultOnMissedCallNotificationHandlerTest {
|
||||
notificationDataFactory = dataFactory,
|
||||
),
|
||||
appNavigationStateService = FakeAppNavigationStateService(),
|
||||
coroutineScope = childScope,
|
||||
coroutineScope = backgroundScope,
|
||||
matrixClientProvider = FakeMatrixClientProvider(),
|
||||
imageLoaderHolder = FakeImageLoaderHolder(),
|
||||
activeNotificationsProvider = FakeActiveNotificationsProvider(),
|
||||
@@ -76,8 +73,5 @@ class DefaultOnMissedCallNotificationHandlerTest {
|
||||
runCurrent()
|
||||
|
||||
dataFactory.messageEventToNotificationsResult.assertions().isCalledOnce()
|
||||
|
||||
// Cancel the coroutine scope so the test can finish
|
||||
childScope.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user