mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
User sessions tests (#390)
* User sessions tests * Refactor - Merge SessionVerificationControllerProxyMock into MockSessionVerificationControllerProxy. - Merge ClientProxyMock into MockClientProxy. - Simplify naming. Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
committed by
GitHub
parent
34eb835a0b
commit
bf9b82334d
@@ -79,14 +79,31 @@ class MockClientProxy: ClientProxyProtocol {
|
||||
throw ClientProxyError.failedLoadingMedia
|
||||
}
|
||||
|
||||
var sessionVerificationControllerProxyResult: Result<SessionVerificationControllerProxyProtocol, ClientProxyError>?
|
||||
func sessionVerificationControllerProxy() async -> Result<SessionVerificationControllerProxyProtocol, ClientProxyError> {
|
||||
.failure(.failedRetrievingSessionVerificationController)
|
||||
if let sessionVerificationControllerProxyResult {
|
||||
return sessionVerificationControllerProxyResult
|
||||
} else {
|
||||
return .failure(.failedRetrievingSessionVerificationController)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func logout() async {
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
var setPusherCalled = false
|
||||
var setPusherErrorToThrow: Error?
|
||||
var setPusherPushkey: String?
|
||||
var setPusherKind: PusherKind?
|
||||
var setPusherAppId: String?
|
||||
var setPusherAppDisplayName: String?
|
||||
var setPusherDeviceDisplayName: String?
|
||||
var setPusherProfileTag: String?
|
||||
var setPusherLang: String?
|
||||
var setPusherUrl: String?
|
||||
var setPusherFormat: PushFormat?
|
||||
var setPusherDefaultPayload: [AnyHashable: Any]?
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func setPusher(pushkey: String,
|
||||
kind: PusherKind?,
|
||||
@@ -98,6 +115,17 @@ class MockClientProxy: ClientProxyProtocol {
|
||||
url: String?,
|
||||
format: PushFormat?,
|
||||
defaultPayload: [AnyHashable: Any]?) async throws {
|
||||
// no-op
|
||||
if let setPusherErrorToThrow { throw setPusherErrorToThrow }
|
||||
setPusherCalled = true
|
||||
setPusherPushkey = pushkey
|
||||
setPusherKind = kind
|
||||
setPusherAppId = appId
|
||||
setPusherAppDisplayName = appDisplayName
|
||||
setPusherDeviceDisplayName = deviceDisplayName
|
||||
setPusherProfileTag = profileTag
|
||||
setPusherLang = lang
|
||||
setPusherUrl = url
|
||||
setPusherFormat = format
|
||||
setPusherDefaultPayload = defaultPayload
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user