diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f3b7d57..5b9189a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,9 +1,11 @@ + = + remote.observeSession(otherProfileId) + } + val viewModel = AppSessionViewModel(newCoordinator(crossProfileGateway), profiles) + backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) { + viewModel.uiState.collect {} + } + advanceUntilIdle() + + assertTrue(viewModel.uiState.value is AppSessionUiState.Login) + } + + @Test + fun successfulAboxLoginAuthenticatesActiveProfile() = runTest { + saveAndActivateAboxProfile(aboxProfileId) + val coordinator = newCoordinator() + val viewModel = AppSessionViewModel(coordinator, profiles) + backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) { + viewModel.uiState.collect {} + } + advanceUntilIdle() + + coordinator.login( + profileId = aboxProfileId, + credentials = credentials, + rememberUsername = false, + autoLogin = false, + ) + advanceUntilIdle() + + val state = viewModel.uiState.value + assertTrue(state is AppSessionUiState.Authenticated) + } + + private companion object { + val aboxProfileId = ProviderProfileId("abox-default") + val otherProfileId = ProviderProfileId("abox-other") + } +}