Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Aug 28, 2024
1 parent fc71cbb commit 1ae360d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
Expand All @@ -34,12 +33,12 @@ import net.mullvad.mullvadvpn.lib.theme.color.AlphaScrollbar
@Preview
@Composable
private fun PreviewDaitaConfirmationDialog() {
AppTheme { DaitaConfirmationDialog(EmptyResultBackNavigator()) }
AppTheme { DaitaConfirmation(EmptyResultBackNavigator()) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun DaitaConfirmationDialog(navigator: ResultBackNavigator<Boolean>) {
fun DaitaConfirmation(navigator: ResultBackNavigator<Boolean>) {
AlertDialog(
onDismissRequest = dropUnlessResumed { navigator.navigateBack(false) },
icon = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ import net.mullvad.mullvadvpn.lib.model.Provider
import net.mullvad.mullvadvpn.lib.model.Providers
import net.mullvad.mullvadvpn.lib.model.RelayItem
import net.mullvad.mullvadvpn.lib.model.RelayItemId
import net.mullvad.mullvadvpn.lib.model.Settings
import net.mullvad.mullvadvpn.relaylist.descendants
import net.mullvad.mullvadvpn.repository.CustomListsRepository
import net.mullvad.mullvadvpn.repository.RelayListFilterRepository
import net.mullvad.mullvadvpn.repository.RelayListRepository
import net.mullvad.mullvadvpn.repository.SettingsRepository
import net.mullvad.mullvadvpn.usecase.AvailableProvidersUseCase
import net.mullvad.mullvadvpn.usecase.FilteredRelayListUseCase
import net.mullvad.mullvadvpn.usecase.customlists.CustomListActionUseCase
Expand All @@ -58,6 +60,9 @@ class SelectLocationViewModelTest {
private val mockCustomListsRepository: CustomListsRepository = mockk()
private val mockCustomListsRelayItemUseCase: CustomListsRelayItemUseCase = mockk()

private val mockSettingsRepository: SettingsRepository = mockk()
private val settingsFlow = MutableStateFlow(mockk<Settings>(relaxed = true))

private lateinit var viewModel: SelectLocationViewModel

private val allProviders = MutableStateFlow<List<Provider>>(emptyList())
Expand All @@ -79,6 +84,7 @@ class SelectLocationViewModelTest {
every { mockFilteredRelayListUseCase() } returns filteredRelayList
every { mockFilteredCustomListRelayItemsUseCase() } returns filteredCustomRelayListItems
every { mockCustomListsRelayItemUseCase() } returns customListsRelayItem
every { mockSettingsRepository.settingsUpdates } returns settingsFlow

mockkStatic(RELAY_LIST_EXTENSIONS)
mockkStatic(RELAY_ITEM_EXTENSIONS)
Expand All @@ -93,6 +99,7 @@ class SelectLocationViewModelTest {
relayListRepository = mockRelayListRepository,
customListsRepository = mockCustomListsRepository,
customListsRelayItemUseCase = mockCustomListsRelayItemUseCase,
settingsRepository = mockSettingsRepository,
)
}

Expand Down

0 comments on commit 1ae360d

Please sign in to comment.