Skip to content

Commit

Permalink
Add unit test for disconnect on welcome viewmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Jun 18, 2024
1 parent c5b8824 commit 786bcd1
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package net.mullvad.mullvadvpn.viewmodel
import androidx.lifecycle.viewModelScope
import app.cash.turbine.test
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkStatic
Expand Down Expand Up @@ -213,6 +214,18 @@ class WelcomeViewModelTest {
}
}

@Test
fun `when on disconnect click is called should call connection proxy disconnect`() = runTest {
// Arrange
coEvery { mockConnectionProxy.disconnect() } returns true

// Act
viewModel.onDisconnectClick()

// Assert
coVerify { mockConnectionProxy.disconnect() }
}

companion object {
private const val PURCHASE_RESULT_EXTENSIONS_CLASS =
"net.mullvad.mullvadvpn.util.PurchaseResultExtensionsKt"
Expand Down

0 comments on commit 786bcd1

Please sign in to comment.