fixing wrong action for starting the sign up
This commit is contained in:
parent
fc5c0579bb
commit
fe206fe130
|
@ -373,7 +373,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
when (action.signMode) {
|
when (action.signMode) {
|
||||||
SignMode.SignUp -> handleRegisterAction(RegisterAction.RegisterDummy)
|
SignMode.SignUp -> handleRegisterAction(RegisterAction.StartRegistration)
|
||||||
SignMode.SignIn -> startAuthenticationFlow()
|
SignMode.SignIn -> startAuthenticationFlow()
|
||||||
SignMode.SignInWithMatrixId -> _viewEvents.post(OnboardingViewEvents.OnSignModeSelected(SignMode.SignInWithMatrixId))
|
SignMode.SignInWithMatrixId -> _viewEvents.post(OnboardingViewEvents.OnSignModeSelected(SignMode.SignInWithMatrixId))
|
||||||
SignMode.Unknown -> Unit
|
SignMode.Unknown -> Unit
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.airbnb.mvrx.Success
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
import com.airbnb.mvrx.test.MvRxTestRule
|
import com.airbnb.mvrx.test.MvRxTestRule
|
||||||
import im.vector.app.features.login.ReAuthHelper
|
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.FakeActiveSessionHolder
|
||||||
import im.vector.app.test.fakes.FakeAnalyticsTracker
|
import im.vector.app.test.fakes.FakeAnalyticsTracker
|
||||||
import im.vector.app.test.fakes.FakeAuthenticationService
|
import im.vector.app.test.fakes.FakeAuthenticationService
|
||||||
|
@ -117,6 +118,24 @@ class OnboardingViewModelTest {
|
||||||
.finish()
|
.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
|
@Test
|
||||||
fun `given register action requires more steps, when handling action, then posts next steps`() = runBlockingTest {
|
fun `given register action requires more steps, when handling action, then posts next steps`() = runBlockingTest {
|
||||||
val test = viewModel.test(this)
|
val test = viewModel.test(this)
|
||||||
|
|
Loading…
Reference in New Issue