Skip to content

Commit

Permalink
Added test for codeInputChanged on isNewDeviceVerification
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-rosado committed Feb 25, 2025
1 parent 5ab5f0e commit eb267f9
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,33 @@ class TwoFactorLoginViewModelTest : BaseViewModelTest() {
)
}

@Test
@Suppress("MaxLineLength")
fun `Continue buttons should only be enabled when code is 8 digit enough on isNewDeviceVerification`() {
val initialState = DEFAULT_STATE.copy(isNewDeviceVerification = true)
val viewModel = createViewModel(initialState)
viewModel.trySendAction(TwoFactorLoginAction.CodeInputChanged("123456"))

// 6 digit should be false when isNewDeviceVerification is true.
assertEquals(
initialState.copy(
codeInput = "123456",
isContinueButtonEnabled = false,
),
viewModel.stateFlow.value,
)

// Set it to true.
viewModel.trySendAction(TwoFactorLoginAction.CodeInputChanged("12345678"))
assertEquals(
initialState.copy(
codeInput = "12345678",
isContinueButtonEnabled = true,
),
viewModel.stateFlow.value,
)
}

@Test
fun `ContinueButtonClick login returns success should update loadingDialogState`() = runTest {
coEvery {
Expand Down

0 comments on commit eb267f9

Please sign in to comment.