From dad3c47378b81897869a0181e9ac76a06ee09e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 2 Oct 2023 17:18:36 +0200 Subject: [PATCH] Fix test --- .../screen/SelectLocationScreenTest.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt index 106d960d1fa2..dd767b0c7a40 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt @@ -75,22 +75,25 @@ class SelectLocationScreenTest { @Test fun testShowRelayListStateSelected() { + val updatedDummyList = + DUMMY_RELAY_COUNTRIES.let { + val cities = it[0].cities.toMutableList() + val city = cities.removeAt(0) + cities.add(0, city.copy(expanded = true)) + + val mutableRelayList = it.toMutableList() + mutableRelayList[0] = it[0].copy(expanded = true, cities = cities.toList()) + mutableRelayList + } + // Arrange composeTestRule.setContent { AppTheme { SelectLocationScreen( uiState = SelectLocationUiState.ShowData( - countries = - DUMMY_RELAY_COUNTRIES.let { - val cities = it[0].cities.toMutableList() - val city = cities.removeAt(0) - cities.add(0, city.copy(expanded = true)) - it.toMutableList()[0] = - it[0].copy(expanded = true, cities = cities.toList()) - it - }, - selectedRelay = DUMMY_RELAY_COUNTRIES[0].cities[0].relays[0] + countries = updatedDummyList, + selectedRelay = updatedDummyList[0].cities[0].relays[0] ), uiCloseAction = MutableSharedFlow(), enterTransitionEndAction = MutableSharedFlow().asSharedFlow()