Skip to content

Commit

Permalink
Merge branch 'replace-deprecated-runblockingtest-droid-311'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Oct 18, 2023
2 parents 0673df6 + f0985d3 commit 6ec049c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -67,7 +66,7 @@ class ChangelogViewModelTest {
}

@Test
fun testShowCaseChangelogWithEmptyListDialog() = runBlockingTest {
fun testShowCaseChangelogWithEmptyListDialog() = runTest {
viewModel.uiState.test {
// Arrange
val fakeEmptyList = emptyList<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,7 +58,7 @@ class DeviceRevokedViewModelTest {
}

@Test
fun testUiStateWhenServiceNotConnected() = runBlockingTest {
fun testUiStateWhenServiceNotConnected() = runTest {
// Arrange, Act, Assert
viewModel.uiState.test {
serviceConnectionState.value = ServiceConnectionState.Disconnected
Expand All @@ -67,7 +67,7 @@ class DeviceRevokedViewModelTest {
}

@Test
fun testUiStateWhenServiceConnectedButNotReady() = runBlockingTest {
fun testUiStateWhenServiceConnectedButNotReady() = runTest {
// Arrange, Act, Assert
viewModel.uiState.test {
serviceConnectionState.value = ServiceConnectionState.ConnectedNotReady(mockk())
Expand All @@ -76,7 +76,7 @@ class DeviceRevokedViewModelTest {
}

@Test
fun testUiStateWhenServiceConnectedAndReady() = runBlockingTest {
fun testUiStateWhenServiceConnectedAndReady() = runTest {
// Arrange
val mockedContainer =
mockk<ServiceConnectionContainer>().apply {
Expand Down

0 comments on commit 6ec049c

Please sign in to comment.