mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
fixing wrong action for starting the sign up
This commit is contained in:
parent
fc5c0579bb
commit
fe206fe130
2 changed files with 20 additions and 1 deletions
|
@ -373,7 +373,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
when (action.signMode) {
|
||||
SignMode.SignUp -> handleRegisterAction(RegisterAction.RegisterDummy)
|
||||
SignMode.SignUp -> handleRegisterAction(RegisterAction.StartRegistration)
|
||||
SignMode.SignIn -> startAuthenticationFlow()
|
||||
SignMode.SignInWithMatrixId -> _viewEvents.post(OnboardingViewEvents.OnSignModeSelected(SignMode.SignInWithMatrixId))
|
||||
SignMode.Unknown -> Unit
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.airbnb.mvrx.Success
|
|||
import com.airbnb.mvrx.Uninitialized
|
||||
import com.airbnb.mvrx.test.MvRxTestRule
|
||||
import im.vector.app.features.login.ReAuthHelper
|
||||
import im.vector.app.features.login.SignMode
|
||||
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
||||
import im.vector.app.test.fakes.FakeAnalyticsTracker
|
||||
import im.vector.app.test.fakes.FakeAuthenticationService
|
||||
|
@ -117,6 +118,24 @@ class OnboardingViewModelTest {
|
|||
.finish()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when handling SignUp then sets sign mode to sign up and starts registration`() = runBlockingTest {
|
||||
givenRegistrationResultFor(RegisterAction.StartRegistration, ANY_CONTINUING_REGISTRATION_RESULT)
|
||||
val test = viewModel.test(this)
|
||||
|
||||
viewModel.handle(OnboardingAction.UpdateSignMode(SignMode.SignUp))
|
||||
|
||||
test
|
||||
.assertStatesWithPrevious(
|
||||
initialState,
|
||||
{ copy(signMode = SignMode.SignUp) },
|
||||
{ copy(asyncRegistration = Loading()) },
|
||||
{ copy(asyncRegistration = Uninitialized) }
|
||||
)
|
||||
.assertEvents(OnboardingViewEvents.RegistrationFlowResult(ANY_CONTINUING_REGISTRATION_RESULT.flowResult, isRegistrationStarted = true))
|
||||
.finish()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given register action requires more steps, when handling action, then posts next steps`() = runBlockingTest {
|
||||
val test = viewModel.test(this)
|
||||
|
|
Loading…
Reference in a new issue