diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModelTest.kt index 7c74e96a75c1..e223a1253980 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModelTest.kt @@ -9,9 +9,8 @@ import io.mockk.just import io.mockk.mockkStatic import io.mockk.unmockkAll import io.mockk.verify -import junit.framework.Assert import kotlin.test.assertEquals -import kotlinx.coroutines.test.runBlockingTest +import kotlinx.coroutines.test.runTest import net.mullvad.mullvadvpn.repository.ChangelogRepository import org.junit.After import org.junit.Before @@ -38,13 +37,13 @@ class ChangelogViewModelTest { } @Test - fun testInitialState() = runBlockingTest { + fun testInitialState() = runTest { // Arrange, Act, Assert - viewModel.uiState.test { Assert.assertEquals(ChangelogDialogUiState.Hide, awaitItem()) } + viewModel.uiState.test { assertEquals(ChangelogDialogUiState.Hide, awaitItem()) } } @Test - fun testShowAndDismissChangelogDialog() = runBlockingTest { + fun testShowAndDismissChangelogDialog() = runTest { viewModel.uiState.test { // Arrange val fakeList = listOf("test") @@ -67,7 +66,7 @@ class ChangelogViewModelTest { } @Test - fun testShowCaseChangelogWithEmptyListDialog() = runBlockingTest { + fun testShowCaseChangelogWithEmptyListDialog() = runTest { viewModel.uiState.test { // Arrange val fakeEmptyList = emptyList() diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt index fa46aff444f3..8959b1f9e375 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt @@ -14,7 +14,7 @@ import io.mockk.verifyOrder import junit.framework.Assert.assertEquals import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.UnconfinedTestDispatcher -import kotlinx.coroutines.test.runBlockingTest +import kotlinx.coroutines.test.runTest import net.mullvad.mullvadvpn.compose.state.DeviceRevokedUiState import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.repository.AccountRepository @@ -58,7 +58,7 @@ class DeviceRevokedViewModelTest { } @Test - fun testUiStateWhenServiceNotConnected() = runBlockingTest { + fun testUiStateWhenServiceNotConnected() = runTest { // Arrange, Act, Assert viewModel.uiState.test { serviceConnectionState.value = ServiceConnectionState.Disconnected @@ -67,7 +67,7 @@ class DeviceRevokedViewModelTest { } @Test - fun testUiStateWhenServiceConnectedButNotReady() = runBlockingTest { + fun testUiStateWhenServiceConnectedButNotReady() = runTest { // Arrange, Act, Assert viewModel.uiState.test { serviceConnectionState.value = ServiceConnectionState.ConnectedNotReady(mockk()) @@ -76,7 +76,7 @@ class DeviceRevokedViewModelTest { } @Test - fun testUiStateWhenServiceConnectedAndReady() = runBlockingTest { + fun testUiStateWhenServiceConnectedAndReady() = runTest { // Arrange val mockedContainer = mockk().apply {