diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt index e6803d4e0858..50a16d1432d0 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt @@ -234,7 +234,7 @@ class ConnectViewModelTest { @Test fun `onDisconnectClick should invoke disconnect on ConnectionProxy`() = runTest { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() // Act viewModel.onDisconnectClick() @@ -246,7 +246,7 @@ class ConnectViewModelTest { @Test fun `onReconnectClick should invoke reconnect on ConnectionProxy`() = runTest { // Arrange - coEvery { mockConnectionProxy.reconnect() } returns true + coEvery { mockConnectionProxy.reconnect() } returns true.right() // Act viewModel.onReconnectClick() @@ -270,7 +270,7 @@ class ConnectViewModelTest { @Test fun `onCancelClick should invoke disconnect on ConnectionProxy`() = runTest { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() // Act viewModel.onCancelClick() 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 b63f59b302be..dde0c898c92e 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 @@ -1,6 +1,7 @@ package net.mullvad.mullvadvpn.viewmodel import app.cash.turbine.test +import arrow.core.right import io.mockk.MockKAnnotations import io.mockk.Runs import io.mockk.coEvery @@ -70,7 +71,7 @@ class DeviceRevokedViewModelTest { @Test fun `onGoToLoginClicked should invoke logout on AccountRepository`() { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() coEvery { mockedAccountRepository.logout() } just Runs // Act @@ -83,7 +84,7 @@ class DeviceRevokedViewModelTest { @Test fun `onGoToLoginClicked should invoke disconnect before logout when connected`() { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() coEvery { mockedAccountRepository.logout() } just Runs // Act 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 c0bf5a135d0b..7deead4e15a8 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 @@ -207,6 +207,9 @@ class LoginViewModelTest { @Test fun `clearAccountHistory should invoke clearAccountHistory on AccountRepository`() = runTest { + // Arrange + coEvery { mockedAccountRepository.clearAccountHistory() } returns Unit.right() + // Act, Assert loginViewModel.clearAccountHistory() coVerify { mockedAccountRepository.clearAccountHistory() } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt index bd26effe821a..886cb58fdaf0 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt @@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.viewmodel import androidx.lifecycle.viewModelScope import app.cash.turbine.test +import arrow.core.right import io.mockk.coEvery import io.mockk.coVerify import io.mockk.every @@ -146,7 +147,7 @@ class OutOfTimeViewModelTest { @Test fun `onDisconnectClick should invoke disconnect on ConnectionProxy`() = runTest { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() // Act viewModel.onDisconnectClick() diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt index 1c7a7d0e3b3e..9ef1455bb723 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt @@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.viewmodel import androidx.lifecycle.viewModelScope import app.cash.turbine.test +import arrow.core.right import io.mockk.coEvery import io.mockk.coVerify import io.mockk.every @@ -217,7 +218,7 @@ class WelcomeViewModelTest { @Test fun `when on disconnect click is called should call connection proxy disconnect`() = runTest { // Arrange - coEvery { mockConnectionProxy.disconnect() } returns true + coEvery { mockConnectionProxy.disconnect() } returns true.right() // Act viewModel.onDisconnectClick()