Skip to content

Commit

Permalink
Renamed lingering references to tunnel ui state
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed May 29, 2024
1 parent defb2cd commit 242c152
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,21 @@ class ConnectViewModelTest {
}

@Test
fun `given change in tunnelUiState uiState should emit new tunnelUiState`() = runTest {
fun `given change in tunnelState uiState should emit new tunnelState`() = runTest {
// Arrange
val tunnelEndpoint: TunnelEndpoint = mockk()
val location: GeoIpLocation = mockk()
val tunnelUiStateTestItem = TunnelState.Connected(tunnelEndpoint, location)
val tunnelStateTestItem = TunnelState.Connected(tunnelEndpoint, location)
every { tunnelEndpoint.toInAddress() } returns mockk(relaxed = true)
every { location.toOutAddress() } returns "1.1.1.1"
every { location.hostname } returns "hostname"

// Act, Assert
viewModel.uiState.test {
assertEquals(ConnectUiState.INITIAL, awaitItem())
tunnelState.emit(tunnelUiStateTestItem)
tunnelState.emit(tunnelStateTestItem)
val result = awaitItem()
assertEquals(tunnelUiStateTestItem, result.tunnelState)
assertEquals(tunnelStateTestItem, result.tunnelState)
}
}

Expand Down Expand Up @@ -283,13 +283,13 @@ class ConnectViewModelTest {
val mockErrorState: ErrorState = mockk()
val expectedConnectNotificationState =
InAppNotification.TunnelStateError(mockErrorState)
val tunnelUiState = TunnelState.Error(mockErrorState)
val tunnelStateError = TunnelState.Error(mockErrorState)
notifications.value = listOf(expectedConnectNotificationState)

// Act, Assert
viewModel.uiState.test {
assertEquals(ConnectUiState.INITIAL, awaitItem())
tunnelState.emit(tunnelUiState)
tunnelState.emit(tunnelStateError)
val result = awaitItem()
assertEquals(expectedConnectNotificationState, result.inAppNotification)
}
Expand Down

0 comments on commit 242c152

Please sign in to comment.