@@ -32,7 +32,6 @@ import net.mullvad.mullvadvpn.lib.model.Providers
32
32
import net.mullvad.mullvadvpn.lib.model.RelayItem
33
33
import net.mullvad.mullvadvpn.lib.model.RelayItemId
34
34
import net.mullvad.mullvadvpn.relaylist.descendants
35
- import net.mullvad.mullvadvpn.relaylist.filterOnSearchTerm
36
35
import net.mullvad.mullvadvpn.repository.CustomListsRepository
37
36
import net.mullvad.mullvadvpn.repository.RelayListFilterRepository
38
37
import net.mullvad.mullvadvpn.repository.RelayListRepository
@@ -170,11 +169,7 @@ class SelectLocationViewModelTest {
170
169
@Test
171
170
fun `on onSearchTermInput call uiState should emit with filtered countries` () = runTest {
172
171
// Arrange
173
- val mockCountries = listOf<RelayItem .Location .Country >(mockk(), mockk())
174
- val selectedItem: RelayItemId ? = null
175
- val mockRelayList: List <RelayItem .Location .Country > = mockk(relaxed = true )
176
172
val mockSearchString = " got"
177
- every { mockCustomList.filterOnSearchTerm(mockSearchString) } returns mockCustomList
178
173
filteredRelayList.value = testCountries
179
174
selectedRelayItemFlow.value = Constraint .Any
180
175
@@ -186,11 +181,17 @@ class SelectLocationViewModelTest {
186
181
// Update search string
187
182
viewModel.onSearchTermInput(mockSearchString)
188
183
189
- // Assert
184
+ // We get some unnecessary emissions for now
185
+ awaitItem()
186
+ awaitItem()
187
+ awaitItem()
188
+
190
189
val actualState = awaitItem()
191
190
assertIs<SelectLocationUiState .Content >(actualState)
192
- // assertLists(mockCountries, actualState.countries)
193
- // assertEquals(selectedItem, actualState.selectedItem)
191
+ assertTrue(
192
+ actualState.relayListItems.filterIsInstance<RelayListItem .GeoLocationItem >().any {
193
+ it.item is RelayItem .Location .City && it.item.name == " Gothenburg"
194
+ })
194
195
}
195
196
}
196
197
0 commit comments