diff options
| author | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2023-09-06 13:26:03 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2023-09-06 13:26:03 +0200 |
| commit | 9786122e86daed287c6e9f9f233301e8d4524789 (patch) | |
| tree | 5d006aba49fc142576be13ef8398f604d6d782fe /android/app/src | |
| parent | 02715c2eb2b011393f4c7ada34d8f70014eb0524 (diff) | |
| parent | 20fe581131a84660a4b1ed57159ad86240fa6dd8 (diff) | |
| download | mullvadvpn-9786122e86daed287c6e9f9f233301e8d4524789.tar.xz mullvadvpn-9786122e86daed287c6e9f9f233301e8d4524789.zip | |
Merge branch 'replace-testcoroutinedispatcher-droid-279'
Diffstat (limited to 'android/app/src')
3 files changed, 10 insertions, 5 deletions
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 32cce31136..fa46aff444 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 @@ -13,7 +13,7 @@ import io.mockk.verify import io.mockk.verifyOrder import junit.framework.Assert.assertEquals import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.test.TestCoroutineDispatcher +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runBlockingTest import net.mullvad.mullvadvpn.compose.state.DeviceRevokedUiState import net.mullvad.mullvadvpn.model.TunnelState @@ -48,7 +48,7 @@ class DeviceRevokedViewModelTest { DeviceRevokedViewModel( mockedServiceConnectionManager, mockedAccountRepository, - TestCoroutineDispatcher() + UnconfinedTestDispatcher() ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt index 6938c4092c..4ba80511c6 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt @@ -11,7 +11,7 @@ import junit.framework.Assert.assertEquals import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.test.TestCoroutineDispatcher +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runBlockingTest import kotlinx.coroutines.test.setMain import net.mullvad.mullvadvpn.lib.ipc.Event @@ -45,7 +45,7 @@ class LoginViewModelTest { @Before fun setup() { - Dispatchers.setMain(TestCoroutineDispatcher()) + Dispatchers.setMain(UnconfinedTestDispatcher()) MockKAnnotations.init(this, relaxUnitFun = true) every { mockedAccountRepository.accountCreationEvents } returns accountCreationTestEvents @@ -59,7 +59,7 @@ class LoginViewModelTest { LoginViewModel( mockedAccountRepository, mockedDeviceRepository, - TestCoroutineDispatcher() + UnconfinedTestDispatcher() ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt index 0d87ed9311..a858913b31 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt @@ -89,9 +89,14 @@ class SettingsViewModelTest { isOutdated = false, isSupported = true ) + every { mockAppVersionInfoCache.version } returns "1.0" + every { mockAppVersionInfoCache.isSupported } returns true + every { mockAppVersionInfoCache.isOutdated } returns false // Act, Assert viewModel.uiState.test { + awaitItem() // Wait for initial value + serviceConnectionState.value = ServiceConnectionState.ConnectedReady(mockServiceConnectionContainer) versionInfo.value = versionInfoTestItem |
