diff --git a/libs/login-api-2/src/main/java/com/instructure/loginapi/login/viewmodel/LoginViewModel.kt b/libs/login-api-2/src/main/java/com/instructure/loginapi/login/viewmodel/LoginViewModel.kt index 35e523ced4..562e9cf516 100644 --- a/libs/login-api-2/src/main/java/com/instructure/loginapi/login/viewmodel/LoginViewModel.kt +++ b/libs/login-api-2/src/main/java/com/instructure/loginapi/login/viewmodel/LoginViewModel.kt @@ -74,7 +74,7 @@ class LoginViewModel @Inject constructor( // We need to wait for the user to be set in ApiPrefs private suspend fun waitForUser() { repeat(30) { - if (ApiPrefs.user != null) return + if (apiPrefs.user != null) return delay(100) } } diff --git a/libs/login-api-2/src/test/java/com/instructure/loginapi/login/viewmodel/LoginViewModelTest.kt b/libs/login-api-2/src/test/java/com/instructure/loginapi/login/viewmodel/LoginViewModelTest.kt index 7d8548de08..0e576df331 100644 --- a/libs/login-api-2/src/test/java/com/instructure/loginapi/login/viewmodel/LoginViewModelTest.kt +++ b/libs/login-api-2/src/test/java/com/instructure/loginapi/login/viewmodel/LoginViewModelTest.kt @@ -67,6 +67,8 @@ class LoginViewModelTest { fun setUp() { lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE) Dispatchers.setMain(testDispatcher) + + every { apiPrefs.user } returns mockk() } @After