[PM-31189] chore: Update tests to use updated MockBiometricsRepository properties (#2283)

This commit is contained in:
Matt Czech 2026-01-26 09:43:18 -06:00 committed by GitHub
parent dfdf43152d
commit 58c4937633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 55 additions and 82 deletions

View File

@ -161,8 +161,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
/// `.canBeLocked(userId:)` should return true when user has face ID.
func test_canBeLocked_hasFaceId() async {
stateService.userHasMasterPassword["1"] = false
stateService.pinProtectedUserKeyValue["1"] = "123"
biometricsRepository.getBiometricUnlockStatusByUserId["1"] = .available(.faceID, enabled: true)
vaultTimeoutService.pinUnlockAvailabilityResult = .success([:])
let result = await subject.canBeLocked(userId: "1")
XCTAssertTrue(result)
}
@ -171,6 +171,7 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
func test_canBeLocked_hasMasterPassword() async {
stateService.userHasMasterPassword["1"] = true
biometricsRepository.getBiometricUnlockStatusByUserId["1"] = .notAvailable
vaultTimeoutService.pinUnlockAvailabilityResult = .success([:])
let result = await subject.canBeLocked(userId: "1")
XCTAssertTrue(result)
}
@ -178,8 +179,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
/// `.canBeLocked(userId:)` should true when user has PIN.
func test_canBeLocked_hasPin() async {
stateService.userHasMasterPassword["1"] = false
stateService.pinProtectedUserKeyValue["1"] = "123"
biometricsRepository.getBiometricUnlockStatusByUserId["1"] = .available(.faceID, enabled: true)
biometricsRepository.getBiometricUnlockStatusByUserId["1"] = .notAvailable
vaultTimeoutService.pinUnlockAvailabilityResult = .success(["1": true])
let result = await subject.canBeLocked(userId: "1")
XCTAssertTrue(result)
}
@ -543,7 +544,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// No unlock methods available (no master password, PIN, or biometrics)
stateService.userHasMasterPassword[anneAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[anneAccount.profile.userId] = nil
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: false)
vaultTimeoutService.sessionTimeoutAction[anneAccount.profile.userId] = .logout
// Account is authenticated (logged in)
stateService.isAuthenticated[anneAccount.profile.userId] = true
@ -566,7 +568,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// No unlock methods available (no master password, PIN, or biometrics)
stateService.userHasMasterPassword[anneAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[anneAccount.profile.userId] = nil
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: false)
// Account is already logged out
stateService.isAuthenticated[anneAccount.profile.userId] = false
@ -589,7 +592,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// No unlock methods available
stateService.userHasMasterPassword[anneAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[anneAccount.profile.userId] = nil
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: false)
await subject.checkSessionTimeouts(handleActiveUser: nil)
@ -608,7 +612,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
vaultTimeoutService.shouldSessionTimeout[anneAccount.profile.userId] = false
// Has master password
stateService.userHasMasterPassword[anneAccount.profile.userId] = true
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: false)
await subject.checkSessionTimeouts(handleActiveUser: nil)
@ -628,7 +633,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// Has PIN unlock
stateService.userHasMasterPassword[anneAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[anneAccount.profile.userId] = "encrypted-pin-key"
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: false)
await subject.checkSessionTimeouts(handleActiveUser: nil)
@ -648,7 +654,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// Has biometrics enabled
stateService.userHasMasterPassword[anneAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[anneAccount.profile.userId] = nil
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: true))
biometricsRepository.getBiometricUnlockStatusByUserId[anneAccount.profile.userId] =
.available(.faceID, enabled: true)
await subject.checkSessionTimeouts(handleActiveUser: nil)
@ -668,7 +675,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
// No unlock methods available
stateService.userHasMasterPassword[beeAccount.profile.userId] = false
stateService.pinProtectedUserKeyValue[beeAccount.profile.userId] = nil
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusByUserId[beeAccount.profile.userId] =
.available(.faceID, enabled: false)
// Account is authenticated (logged in)
stateService.isAuthenticated[beeAccount.profile.userId] = true
@ -845,7 +853,8 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo
claimedAccount.profile.userId: false,
]
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: true))
biometricsRepository.getBiometricUnlockStatusByUserId[claimedAccount.profile.userId] =
.available(.faceID, enabled: true)
let accounts2 = await subject.getProfilesState(
allowLockAndLogout: true,
isVisible: true,

View File

@ -3,7 +3,6 @@
class MockBiometricsRepository: BiometricsRepository {
var getBiometricAuthenticationTypeResult: BitwardenShared.BiometricAuthenticationType?
var biometricUnlockStatus: Result<BiometricsUnlockStatus, Error>?
var getBiometricUnlockStatusError: Error?
var getBiometricUnlockStatusActiveUser = BiometricsUnlockStatus.notAvailable
var getBiometricUnlockStatusByUserId = [String: BiometricsUnlockStatus]()
@ -22,10 +21,6 @@ class MockBiometricsRepository: BiometricsRepository {
if let getBiometricUnlockStatusError {
throw getBiometricUnlockStatusError
}
if let biometricUnlockStatus {
// TODO: PM-31189 Legacy mock value, update all tests to use getBiometricUnlockStatusByUserId
return try biometricUnlockStatus.get()
}
guard let userId else {
return getBiometricUnlockStatusActiveUser
}

View File

@ -51,7 +51,7 @@ class VaultUnlockSetupHelperTests: BitwardenTestCase {
/// `setBiometricUnlock()` successfully disables biometric unlock.
func test_setBiometricUnlock_disable() async {
let disabledStatus = BiometricsUnlockStatus.available(.faceID, enabled: false)
biometricsRepository.biometricUnlockStatus = .success(disabledStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = disabledStatus
var alertsShown = [Alert]()
let status = await subject.setBiometricUnlock(enabled: false) { alert in
@ -66,7 +66,7 @@ class VaultUnlockSetupHelperTests: BitwardenTestCase {
/// `setBiometricUnlock()` successfully enables biometric unlock.
func test_setBiometricUnlock_enable() async {
let enabledStatus = BiometricsUnlockStatus.available(.faceID, enabled: true)
biometricsRepository.biometricUnlockStatus = .success(enabledStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = enabledStatus
var alertsShown = [Alert]()
let status = await subject.setBiometricUnlock(enabled: true) { alert in
@ -82,7 +82,7 @@ class VaultUnlockSetupHelperTests: BitwardenTestCase {
func test_setBiometricUnlock_allowBiometricUnlockFailure() async {
let unlockStatus = BiometricsUnlockStatus.available(.faceID, enabled: true)
authRepository.allowBiometricUnlockResult = .failure(BitwardenTestError.example)
biometricsRepository.biometricUnlockStatus = .success(unlockStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = unlockStatus
var alertsShown = [Alert]()
let status = await subject.setBiometricUnlock(enabled: true) { alert in
@ -96,7 +96,7 @@ class VaultUnlockSetupHelperTests: BitwardenTestCase {
/// `setBiometricUnlock()` shows an alert and logs an error if getting the biometric unlock status fails.
func test_setBiometricUnlock_getBiometricUnlockStatusFailure() async {
biometricsRepository.biometricUnlockStatus = .failure(BitwardenTestError.example)
biometricsRepository.getBiometricUnlockStatusError = BitwardenTestError.example
var alertsShown = [Alert]()
let status = await subject.setBiometricUnlock(enabled: true) { alert in

View File

@ -66,8 +66,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
@MainActor
func test_perform_appeared_biometricUnlockStatus_error() async {
stateService.activeAccount = .fixture()
struct FetchError: Error {}
biometricsRepository.biometricUnlockStatus = .failure(FetchError())
biometricsRepository.getBiometricUnlockStatusError = BitwardenTestError.example
await subject.perform(.appeared)
XCTAssertEqual([], subject.state.profileSwitcherState.alternateAccounts)
@ -80,7 +79,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_biometricUnlockStatus_success() async {
stateService.activeAccount = .fixture()
let expectedStatus = BiometricsUnlockStatus.available(.touchID, enabled: true)
biometricsRepository.biometricUnlockStatus = .success(expectedStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = expectedStatus
await subject.perform(.appeared)
XCTAssertEqual([], subject.state.profileSwitcherState.alternateAccounts)
@ -105,9 +104,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_loadData_unlockWithBiometrics_background() async throws {
application.applicationState = .background
stateService.activeAccount = .fixture()
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
subject.shouldAttemptAutomaticBiometricUnlock = true
await subject.perform(.appeared)
@ -122,7 +119,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_shouldShowPasswordOrPinFields_false() async {
stateService.activeAccount = .fixture()
let expectedStatus = BiometricsUnlockStatus.available(.touchID, enabled: true)
biometricsRepository.biometricUnlockStatus = .success(expectedStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = expectedStatus
authRepository.isPinUnlockAvailableResult = .success(false)
authRepository.hasMasterPasswordResult = .success(false)
await subject.perform(.appeared)
@ -137,7 +134,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_shouldShowPasswordOrPinFields_true_pin() async {
stateService.activeAccount = .fixture()
let expectedStatus = BiometricsUnlockStatus.notAvailable
biometricsRepository.biometricUnlockStatus = .success(expectedStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = expectedStatus
authRepository.isPinUnlockAvailableResult = .success(true)
authRepository.hasMasterPasswordResult = .success(false)
await subject.perform(.appeared)
@ -152,7 +149,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_shouldShowPasswordOrPinFields_true_masterPassword() async {
stateService.activeAccount = .fixture()
let expectedStatus = BiometricsUnlockStatus.notAvailable
biometricsRepository.biometricUnlockStatus = .success(expectedStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = expectedStatus
authRepository.isPinUnlockAvailableResult = .success(false)
authRepository.hasMasterPasswordResult = .success(true)
await subject.perform(.appeared)
@ -167,7 +164,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_appeared_shouldShowPasswordOrPinFields_true_masterPasswordError() async {
stateService.activeAccount = .fixture()
let expectedStatus = BiometricsUnlockStatus.notAvailable
biometricsRepository.biometricUnlockStatus = .success(expectedStatus)
biometricsRepository.getBiometricUnlockStatusActiveUser = expectedStatus
authRepository.isPinUnlockAvailableResult = .success(false)
authRepository.hasMasterPasswordResult = .failure(BitwardenTestError.example)
await subject.perform(.appeared)
@ -607,9 +604,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
@MainActor
func test_perform_unlockWithBiometrics_biometryLocked() async throws {
stateService.activeAccount = .fixture()
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.biometryLocked)
await subject.perform(.unlockVaultWithBiometrics)
@ -623,9 +618,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_unlockWithBiometrics_extensionKdfWarning() async throws {
appExtensionDelegate.isInAppExtension = true
authRepository.unlockVaultWithBiometricsResult = .success(())
biometricsRepository.biometricUnlockStatus = .success(
.available(.faceID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.faceID, enabled: true)
stateService.activeAccount = .fixture(profile: .fixture(kdfMemory: 65, kdfType: .argon2id))
subject.state.biometricUnlockStatus = .available(.touchID, enabled: true)
@ -642,9 +635,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// `perform(_:)` with `.unlockWithBiometrics` requires a set user preference.
@MainActor
func test_perform_unlockWithBiometrics_noAccount() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.faceID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.faceID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(StateServiceError.noActiveAccount)
subject.state.biometricUnlockStatus = .available(.touchID, enabled: true)
@ -657,7 +648,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// `perform(_:)` with `.unlockWithBiometrics` requires a set user preference.
@MainActor
func test_perform_unlockWithBiometrics_notAvailable() async throws {
biometricsRepository.biometricUnlockStatus = .success(.notAvailable)
biometricsRepository.getBiometricUnlockStatusActiveUser = .notAvailable
authRepository.unlockVaultWithBiometricsResult = .success(())
subject.state.biometricUnlockStatus = .available(.touchID, enabled: true)
@ -668,9 +659,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// `perform(_:)` with `.unlockWithBiometrics` requires a set user preference.
@MainActor
func test_perform_unlockWithBiometrics_notEnabled() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: false),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: false)
authRepository.unlockVaultWithBiometricsResult = .success(())
subject.state.biometricUnlockStatus = .available(.touchID, enabled: true)
@ -682,9 +671,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
@MainActor
func test_perform_unlockWithBiometrics_authRepoError() async throws {
stateService.activeAccount = .fixture()
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
struct BiometricsError: Error {}
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsError())
@ -704,9 +691,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
func test_perform_unlockWithBiometrics_authRepoError_maxAttempts() async throws {
stateService.activeAccount = .fixture()
subject.state.unsuccessfulUnlockAttemptsCount = 4
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
struct BiometricsError: Error {}
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsError())
@ -729,9 +714,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// `perform(_:)` with `.unlockWithBiometrics` requires successful biometrics.
@MainActor
func test_perform_unlockWithBiometrics_authRepoError_getAuthKeyFailed() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.getAuthKeyFailed)
authRepository.allowBiometricUnlockResult = .success(())
@ -744,9 +727,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// exist and they have a master password but no PIN.
@MainActor
func test_perform_unlockWithBiometrics_authRepoError_getAuthKeyFailed_masterPasswordWithoutPin() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.getAuthKeyFailed)
authRepository.allowBiometricUnlockResult = .success(())
authRepository.hasMasterPasswordResult = .success(true)
@ -761,9 +742,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// exist and they have a PIN but no master password.
@MainActor
func test_perform_unlockWithBiometrics_authRepoError_getAuthKeyFailed_pinWithoutMasterPassword() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.getAuthKeyFailed)
authRepository.allowBiometricUnlockResult = .success(())
authRepository.hasMasterPasswordResult = .success(false)
@ -778,9 +757,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// exist and they don't have a master password or PIN.
@MainActor
func test_perform_unlockWithBiometrics_authRepoError_getAuthKeyFailed_noMPOrPin() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.getAuthKeyFailed)
authRepository.allowBiometricUnlockResult = .success(())
authRepository.hasMasterPasswordResult = .success(false)
@ -795,9 +772,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// exist and fetching whether they have a master password fails.
@MainActor
func test_perform_unlockWithBiometrics_authRepoError_getAuthKeyFailed_hasMasterPasswordError() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.getAuthKeyFailed)
authRepository.allowBiometricUnlockResult = .success(())
authRepository.hasMasterPasswordResult = .failure(BitwardenTestError.example)
@ -811,9 +786,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
/// `perform(_:)` with `.unlockWithBiometrics` handles user cancellation.
@MainActor
func test_perform_unlockWithBiometrics_userCancelled() async throws {
biometricsRepository.biometricUnlockStatus = .success(
.available(.touchID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.touchID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .failure(BiometricsServiceError.biometryCancelled)
authRepository.allowBiometricUnlockResult = .success(())
@ -826,9 +799,7 @@ class VaultUnlockProcessorTests: BitwardenTestCase { // swiftlint:disable:this t
@MainActor
func test_perform_unlockWithBiometrics_success() async throws {
subject.state.unsuccessfulUnlockAttemptsCount = 3
biometricsRepository.biometricUnlockStatus = .success(
.available(.faceID, enabled: true),
)
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.faceID, enabled: true)
authRepository.unlockVaultWithBiometricsResult = .success(())
await subject.perform(.unlockVaultWithBiometrics)

View File

@ -89,7 +89,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
@MainActor
func test_perform_loadData() async {
let status = BiometricsUnlockStatus.available(.faceID, enabled: false)
biometricsRepository.biometricUnlockStatus = .success(status)
biometricsRepository.getBiometricUnlockStatusActiveUser = status
await subject.perform(.loadData)
@ -101,7 +101,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
@MainActor
func test_perform_loadData_biometrics() async {
let status = BiometricsUnlockStatus.available(.unknown, enabled: false)
biometricsRepository.biometricUnlockStatus = .success(status)
biometricsRepository.getBiometricUnlockStatusActiveUser = status
await subject.perform(.loadData)
@ -112,7 +112,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
/// `perform(_:)` with `.loadData` logs the error and shows an alert if one occurs.
@MainActor
func test_perform_loadData_error() async {
biometricsRepository.biometricUnlockStatus = .failure(BitwardenTestError.example)
biometricsRepository.getBiometricUnlockStatusError = BitwardenTestError.example
await subject.perform(.loadData)
@ -125,7 +125,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
@MainActor
func test_perform_loadData_noBiometrics() async {
let status = BiometricsUnlockStatus.notAvailable
biometricsRepository.biometricUnlockStatus = .success(status)
biometricsRepository.getBiometricUnlockStatusActiveUser = status
await subject.perform(.loadData)
@ -137,7 +137,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
@MainActor
func test_perform_loadData_opticID() async {
let status = BiometricsUnlockStatus.available(.opticID, enabled: false)
biometricsRepository.biometricUnlockStatus = .success(status)
biometricsRepository.getBiometricUnlockStatusActiveUser = status
await subject.perform(.loadData)
@ -149,7 +149,7 @@ class VaultUnlockSetupProcessorTests: BitwardenTestCase {
@MainActor
func test_perform_loadData_touchID() async {
let status = BiometricsUnlockStatus.available(.touchID, enabled: false)
biometricsRepository.biometricUnlockStatus = .success(status)
biometricsRepository.getBiometricUnlockStatusActiveUser = status
await subject.perform(.loadData)

View File

@ -418,9 +418,7 @@ class AccountSecurityProcessorTests: BitwardenTestCase { // swiftlint:disable:th
@MainActor
func test_perform_loadData_biometricsValue() async {
let biometricUnlockStatus = BiometricsUnlockStatus.available(.faceID, enabled: true)
biometricsRepository.biometricUnlockStatus = .success(
biometricUnlockStatus,
)
biometricsRepository.getBiometricUnlockStatusActiveUser = biometricUnlockStatus
subject.state.biometricUnlockStatus = .notAvailable
await subject.perform(.loadData)
@ -431,7 +429,7 @@ class AccountSecurityProcessorTests: BitwardenTestCase { // swiftlint:disable:th
@MainActor
func test_perform_loadData_biometricsValue_error() async {
struct TestError: Error {}
biometricsRepository.biometricUnlockStatus = .failure(TestError())
biometricsRepository.getBiometricUnlockStatusError = TestError()
subject.state.biometricUnlockStatus = .notAvailable
await subject.perform(.loadData)
@ -468,11 +466,11 @@ class AccountSecurityProcessorTests: BitwardenTestCase { // swiftlint:disable:th
stateService.activeAccount = .fixture()
stateService.accountSetupVaultUnlock["1"] = .setUpLater
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: false))
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.faceID, enabled: false)
await subject.perform(.loadData)
XCTAssertEqual(stateService.accountSetupVaultUnlock["1"], .setUpLater)
biometricsRepository.biometricUnlockStatus = .success(.available(.faceID, enabled: true))
biometricsRepository.getBiometricUnlockStatusActiveUser = .available(.faceID, enabled: true)
await subject.perform(.loadData)
XCTAssertEqual(stateService.accountSetupVaultUnlock["1"], .complete)
}