Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Jul 22, 2024
1 parent ba9149d commit f8f80e8
Showing 1 changed file with 2 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import io.mockk.mockk
import io.mockk.verify
import net.mullvad.mullvadvpn.compose.createEdgeToEdgeComposeExtension
import net.mullvad.mullvadvpn.compose.setContentWithTheme
import net.mullvad.mullvadvpn.compose.test.SERVER_IP_OVERRIDES_IMPORT_BY_FILE_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SERVER_IP_OVERRIDES_IMPORT_BY_TEXT_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SERVER_IP_OVERRIDE_IMPORT_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SERVER_IP_OVERRIDE_INFO_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SERVER_IP_OVERRIDE_MORE_VERT_TEST_TAG
Expand All @@ -37,16 +35,14 @@ class ServerIpOverridesScreenTest {
onBackClick: () -> Unit = {},
onInfoClick: () -> Unit = {},
onResetOverridesClick: () -> Unit = {},
onImportByFile: () -> Unit = {},
onImportByText: () -> Unit = {},
showBottomSheet: () -> Unit = {},
) {
ServerIpOverridesScreen(
state = state,
onBackClick = onBackClick,
onInfoClick = onInfoClick,
onResetOverridesClick = onResetOverridesClick,
onImportByFile = onImportByFile,
onImportByText = onImportByText
showBottomSheet = showBottomSheet
)
}

Expand Down Expand Up @@ -127,46 +123,6 @@ class ServerIpOverridesScreenTest {
onNodeWithTag(SERVER_IP_OVERRIDE_MORE_VERT_TEST_TAG).performClick()
onNodeWithTag(SERVER_IP_OVERRIDE_RESET_OVERRIDES_TEST_TAG).performClick()

// Assert
verify { clickHandler() }
}

@Test
fun ensure_import_by_file_works() =
composeExtension.use {
// Arrange
val clickHandler: () -> Unit = mockk(relaxed = true)
setContentWithTheme {
ScreenWithDefault(
state = ServerIpOverridesViewState.Loaded(false),
onImportByFile = clickHandler
)
}

// Act
onNodeWithTag(SERVER_IP_OVERRIDE_IMPORT_TEST_TAG).performClick()
onNodeWithTag(SERVER_IP_OVERRIDES_IMPORT_BY_FILE_TEST_TAG).performClick()

// Assert
verify { clickHandler() }
}

@Test
fun ensure_import_by_text() =
composeExtension.use {
// Arrange
val clickHandler: () -> Unit = mockk(relaxed = true)
setContentWithTheme {
ScreenWithDefault(
state = ServerIpOverridesViewState.Loaded(false),
onImportByText = clickHandler
)
}

// Act
onNodeWithTag(SERVER_IP_OVERRIDE_IMPORT_TEST_TAG).performClick()
onNodeWithTag(SERVER_IP_OVERRIDES_IMPORT_BY_TEXT_TEST_TAG).performClick()

// Assert
verify { clickHandler() }
}
Expand Down

0 comments on commit f8f80e8

Please sign in to comment.