Skip to content

Commit

Permalink
Remove runBlockingTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa authored and Pururun committed Oct 18, 2023
1 parent 0673df6 commit f0985d3
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 f0985d3

Please sign in to comment.