Update MockingKit invokation code

This commit is contained in:
Daniel Saidi 2021-09-08 10:37:03 +02:00
parent a7e4653ab0
commit 139578e442
4 changed files with 6 additions and 6 deletions

View File

@ -102,14 +102,14 @@ private class TestClass: BiometricAuthenticationService, Mockable {
var authError: Error?
override func canAuthenticateUser(for auth: Authentication) -> Bool {
invoke(canAuthenticateUserRef, args: (auth))
call(canAuthenticateUserRef, args: (auth))
}
override func performAuthentication(
for auth: Authentication,
reason: String,
completion: @escaping AuthCompletion) {
invoke(performAuthenticationRef, args: (auth, reason, completion))
call(performAuthenticationRef, args: (auth, reason, completion))
if let error = authError { return completion(.failure(error)) }
completion(.success(()))
}

View File

@ -17,12 +17,12 @@ class MockAuthenticationService: Mock, AuthenticationService {
var authError: Error?
func authenticateUser(for auth: Authentication, reason: String, completion: @escaping AuthCompletion) {
invoke(authenticateUserRef, args: (auth, reason, completion))
call(authenticateUserRef, args: (auth, reason, completion))
if let error = authError { return completion(.failure(error)) }
completion(.success(()))
}
func canAuthenticateUser(for auth: Authentication) -> Bool {
invoke(canAuthenticateUserRef, args: (auth))
call(canAuthenticateUserRef, args: (auth))
}
}

View File

@ -15,6 +15,6 @@ class MockDeviceIdentifier: Mock, DeviceIdentifier {
lazy var getDeviceIdentifierRef = MockReference(getDeviceIdentifier)
func getDeviceIdentifier() -> String {
invoke(getDeviceIdentifierRef, args: ())
call(getDeviceIdentifierRef, args: ())
}
}

View File

@ -68,7 +68,7 @@ class MockKeychainService: KeychainService, Mockable {
func set(_ value: String, for key: String, with accessibility: KeychainItemAccessibility?) -> Bool {
mock.registerResult(for: stringRef) { _, _ in value }
mock.registerResult(for: setStringRef) { _, _, _ in true }
_ = mock.invoke(self.setStringRef, args: (value, key, accessibility))
_ = mock.call(self.setStringRef, args: (value, key, accessibility))
return true
}
}