@@ -105,6 +105,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
105
105
private val settingsRepository: SettingsRepository = mockk {
106
106
every { initialAutofillDialogShown = any() } just runs
107
107
every { initialAutofillDialogShown } returns true
108
+ every { isUnlockWithPinEnabled } returns false
108
109
}
109
110
private val mutableUserStateFlow = MutableStateFlow <UserState ?>(createUserState())
110
111
private val authRepository: AuthRepository = mockk {
@@ -3684,8 +3685,9 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
3684
3685
3685
3686
@Suppress(" MaxLineLength" )
3686
3687
@Test
3687
- fun `UserVerificationNotSupported should display Fido2PinPrompt when user has pin` () {
3688
+ fun `UserVerificationNotSupported should display Fido2PinPrompt when user has pin unlock enabled ` () {
3688
3689
val userState = createUserState()
3690
+ every { settingsRepository.isUnlockWithPinEnabled } returns true
3689
3691
mutableUserStateFlow.value = userState.copy(
3690
3692
accounts = listOf (
3691
3693
userState.accounts.first().copy(
@@ -3714,7 +3716,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
3714
3716
3715
3717
@Suppress(" MaxLineLength" )
3716
3718
@Test
3717
- fun `UserVerificationNotSupported should display Fido2PinSetUpPrompt when user has no password or pin` () {
3719
+ fun `UserVerificationNotSupported should display Fido2PinSetUpPrompt when user has no password or pin and vaultUnlockType is MASTER_PASSWORD ` () {
3718
3720
val userState = createUserState()
3719
3721
mutableUserStateFlow.value = userState.copy(
3720
3722
accounts = listOf (
@@ -3740,6 +3742,34 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
3740
3742
)
3741
3743
}
3742
3744
3745
+ @Suppress(" MaxLineLength" )
3746
+ @Test
3747
+ fun `UserVerificationNotSupported should display Fido2PinSetUpPrompt when user has no password or pin and vaultUnlockType is PIN` () {
3748
+ val userState = createUserState()
3749
+ mutableUserStateFlow.value = userState.copy(
3750
+ accounts = listOf (
3751
+ userState.accounts.first().copy(
3752
+ vaultUnlockType = VaultUnlockType .PIN ,
3753
+ trustedDevice = UserState .TrustedDevice (
3754
+ isDeviceTrusted = true ,
3755
+ hasAdminApproval = true ,
3756
+ hasLoginApprovingDevice = true ,
3757
+ hasResetPasswordPermission = true ,
3758
+ ),
3759
+ hasMasterPassword = false ,
3760
+ ),
3761
+ ),
3762
+ )
3763
+
3764
+ viewModel.trySendAction(VaultAddEditAction .Common .UserVerificationNotSupported )
3765
+
3766
+ verify { fido2CredentialManager.isUserVerified = false }
3767
+ assertEquals(
3768
+ VaultAddEditState .DialogState .Fido2PinSetUpPrompt ,
3769
+ viewModel.stateFlow.value.dialog,
3770
+ )
3771
+ }
3772
+
3743
3773
@Suppress(" MaxLineLength" )
3744
3774
@Test
3745
3775
fun `MasterPasswordFido2VerificationSubmit should display Fido2Error when password verification fails` () {
0 commit comments