* feat(#471): implement DataStore-based server configuration and self-healing * refactor(#471): address Sourcery feedback on ANR risk and reset method splitting * refactor(#471): implement synchronous ServerStore initialization to fully remove ANR risk * feat(#471): show profile name, host and port on add profile, redirect to login on save, and support shortcut login buttons for existing profiles
This commit is contained in:
20 files changed
+774
-288
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package com.m57.hermescontrol.ui.settings
|
||||
|
||||
import com.m57.hermescontrol.data.config.ConnectionProfile
|
||||
import com.m57.hermescontrol.data.local.AuthManager
|
||||
import com.m57.hermescontrol.data.model.ConnectionProfile
|
||||
import com.m57.hermescontrol.data.remote.ApiClient
|
||||
import com.m57.hermescontrol.theme.BottomNavDisplayMode
|
||||
import com.m57.hermescontrol.theme.ThemePreference
|
||||
@@ -218,4 +218,25 @@ class SettingsViewModelTest {
|
||||
verify(exactly = 0) { AuthManager.setSelectedProfileId(null) }
|
||||
verify { ApiClient.rebuild() }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSaveProfileFromDialog_addsNewProfileAndTriggersLoginRedirection() {
|
||||
every { AuthManager.getConnectionProfiles() } returns emptyList()
|
||||
val viewModel = createViewModel()
|
||||
|
||||
viewModel.openAddProfile()
|
||||
viewModel.onDialogProfileNameChange("Test Profile")
|
||||
viewModel.onDialogProfileHostChange("192.168.1.100")
|
||||
viewModel.onDialogProfilePortChange("9999")
|
||||
|
||||
viewModel.saveProfileFromDialog()
|
||||
testDispatcher.scheduler.advanceUntilIdle()
|
||||
|
||||
verify { AuthManager.saveConnectionProfiles(any()) }
|
||||
verify { AuthManager.setSelectedProfileId(any()) }
|
||||
assertEquals(true, viewModel.uiState.value.navigateToLogin)
|
||||
|
||||
viewModel.clearNavigateToLogin()
|
||||
assertEquals(false, viewModel.uiState.value.navigateToLogin)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user