Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Aug 6, 2024
1 parent b8a3130 commit cc89574
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.viewmodel

import android.app.Activity
import app.cash.turbine.test
import arrow.core.right
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.every
Expand Down Expand Up @@ -93,6 +94,9 @@ class AccountViewModelTest {

@Test
fun `onLogoutClick should invoke logout on AccountRepository`() {
// Arrange
coEvery { mockAccountRepository.logout() } returns Unit.right()

// Act
viewModel.onLogoutClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ 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
import io.mockk.coVerify
import io.mockk.coVerifyOrder
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.just
import io.mockk.mockk
import io.mockk.unmockkAll
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -72,7 +70,7 @@ class DeviceRevokedViewModelTest {
fun `onGoToLoginClicked should invoke logout on AccountRepository`() {
// Arrange
coEvery { mockConnectionProxy.disconnect() } returns true.right()
coEvery { mockedAccountRepository.logout() } just Runs
coEvery { mockedAccountRepository.logout() } returns Unit.right()

// Act
viewModel.onGoToLoginClicked()
Expand All @@ -85,7 +83,7 @@ class DeviceRevokedViewModelTest {
fun `onGoToLoginClicked should invoke disconnect before logout when connected`() {
// Arrange
coEvery { mockConnectionProxy.disconnect() } returns true.right()
coEvery { mockedAccountRepository.logout() } just Runs
coEvery { mockedAccountRepository.logout() } returns Unit.right()

// Act
viewModel.onGoToLoginClicked()
Expand Down

0 comments on commit cc89574

Please sign in to comment.