mirror of
https://github.com/bitwarden/android.git
synced 2026-05-11 02:15:43 -05:00
[PM-6702] Fix StartRegistration tests
This commit is contained in:
@@ -99,15 +99,6 @@ class StartRegistrationScreenTest : BaseComposeTest() {
|
||||
assertTrue(onNavigateToEnvironmentCalled)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `NavigateToCaptcha event should invoke intent manager`() {
|
||||
val mockUri = mockk<Uri>()
|
||||
mutableEventFlow.tryEmit(StartRegistrationEvent.NavigateToCaptcha(uri = mockUri))
|
||||
verify {
|
||||
intentManager.startCustomTabsActivity(mockUri)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `NavigateToPrivacyPolicy event should invoke intent manager`() {
|
||||
mutableEventFlow.tryEmit(StartRegistrationEvent.NavigateToPrivacyPolicy)
|
||||
|
||||
@@ -139,7 +139,6 @@ class StartRegistrationViewModelTest : BaseViewModelTest() {
|
||||
email = EMAIL,
|
||||
name= NAME,
|
||||
receiveMarketingEmails = true,
|
||||
captchaToken = null,
|
||||
)
|
||||
} returns SendVerificationEmailResult.Success(
|
||||
emailVerificationToken = "verification_token"
|
||||
@@ -177,7 +176,6 @@ class StartRegistrationViewModelTest : BaseViewModelTest() {
|
||||
email = EMAIL,
|
||||
name= NAME,
|
||||
receiveMarketingEmails = true,
|
||||
captchaToken = null,
|
||||
)
|
||||
} returns SendVerificationEmailResult.Error(errorMessage = "mock_error")
|
||||
}
|
||||
@@ -207,37 +205,6 @@ class StartRegistrationViewModelTest : BaseViewModelTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ContinueClick register returns CaptchaRequired should emit NavigateToCaptcha`() = runTest {
|
||||
val mockkUri = mockk<Uri>()
|
||||
every {
|
||||
generateUriForCaptcha(captchaId = "mock_captcha_id")
|
||||
} returns mockkUri
|
||||
val repo = mockk<AuthRepository> {
|
||||
every { captchaTokenResultFlow } returns flowOf()
|
||||
coEvery {
|
||||
sendVerificationEmail(
|
||||
email = EMAIL,
|
||||
name= NAME,
|
||||
receiveMarketingEmails = true,
|
||||
captchaToken = null,
|
||||
)
|
||||
} returns SendVerificationEmailResult.CaptchaRequired(captchaId = "mock_captcha_id")
|
||||
}
|
||||
val viewModel = StartRegistrationViewModel(
|
||||
savedStateHandle = validInputHandle,
|
||||
authRepository = repo,
|
||||
environmentRepository = fakeEnvironmentRepository
|
||||
)
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(StartRegistrationAction.ContinueClick)
|
||||
assertEquals(
|
||||
StartRegistrationEvent.NavigateToCaptcha(uri = mockkUri),
|
||||
awaitItem(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `ContinueClick register returns Success should emit NavigateToCheckEmail`() = runTest {
|
||||
val mockkUri = mockk<Uri>()
|
||||
@@ -251,7 +218,6 @@ class StartRegistrationViewModelTest : BaseViewModelTest() {
|
||||
email = EMAIL,
|
||||
name= NAME,
|
||||
receiveMarketingEmails = true,
|
||||
captchaToken = null,
|
||||
)
|
||||
} returns SendVerificationEmailResult.Success(emailVerificationToken = "verification_token",)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user