adding test around resending reset password email

This commit is contained in:
Adam Brown 2022-06-07 16:53:59 +01:00
parent 4200b4b5e9
commit 3c03bae4c5
1 changed files with 19 additions and 0 deletions

View File

@ -499,6 +499,25 @@ class OnboardingViewModelTest {
.finish() .finish()
} }
@Test
fun `given reset state, when resending reset password email, then emits reset success`() = runTest {
viewModelWith(initialState.copy(resetState = ResetState(AN_EMAIL, A_PASSWORD)))
val test = viewModel.test()
fakeLoginWizard.givenResetPasswordSuccess(AN_EMAIL)
fakeAuthenticationService.givenLoginWizard(fakeLoginWizard)
viewModel.handle(OnboardingAction.ResendResetPassword)
test
.assertStatesChanges(
initialState,
{ copy(isLoading = true) },
{ copy(isLoading = false) }
)
.assertNoEvents()
.finish()
}
@Test @Test
fun `given can successfully confirm reset password, when confirm reset password, then emits reset success`() = runTest { fun `given can successfully confirm reset password, when confirm reset password, then emits reset success`() = runTest {
viewModelWith(initialState.copy(resetState = ResetState(AN_EMAIL, A_PASSWORD))) viewModelWith(initialState.copy(resetState = ResetState(AN_EMAIL, A_PASSWORD)))