mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
BIT-2156: auto-prompt the user for biometrics (#1307)
This commit is contained in:
committed by
Álison Fernandes
parent
bb1fd4ae4f
commit
bde338ef44
+13
@@ -75,6 +75,19 @@ class VaultUnlockScreenTest : BaseComposeTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on PromptForBiometrics should call launchUri on intentManager`() {
|
||||
mutableEventFlow.tryEmit(VaultUnlockEvent.PromptForBiometrics)
|
||||
verify {
|
||||
biometricsManager.promptBiometrics(
|
||||
onSuccess = any(),
|
||||
onCancel = any(),
|
||||
onError = any(),
|
||||
onLockOut = any(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `account icon click should show the account switcher`() {
|
||||
composeTestRule.assertSwitcherIsNotDisplayed(
|
||||
|
||||
+14
@@ -1,6 +1,7 @@
|
||||
package com.x8bit.bitwarden.ui.auth.feature.vaultunlock
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import app.cash.turbine.test
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.data.auth.datasource.disk.model.EnvironmentUrlDataJson
|
||||
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
||||
@@ -54,6 +55,19 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
||||
every { isBiometricIntegrityValid(userId = DEFAULT_USER_STATE.activeUserId) } returns true
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on init with biometrics enabled and valid should emit PromptForBiometrics`() = runTest {
|
||||
val initialState = DEFAULT_STATE.copy(
|
||||
isBiometricEnabled = true,
|
||||
isBiometricsValid = true,
|
||||
)
|
||||
val viewModel = createViewModel(state = initialState)
|
||||
|
||||
viewModel.eventFlow.test {
|
||||
assertEquals(VaultUnlockEvent.PromptForBiometrics, awaitItem())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `initial state should be correct when not set`() {
|
||||
val viewModel = createViewModel()
|
||||
|
||||
Reference in New Issue
Block a user