mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Generating SDK Mocks through the usage of swift run tools generate-sdk-mocks (#982)
* basic implementation, that works for now only with the local SDK * replaced a handmade mock with a generated mock
This commit is contained in:
@@ -351,7 +351,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError> {
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError> {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
do {
|
||||
return try .success(.init(sdkResults: self.client.searchUsers(searchTerm: searchTerm, limit: UInt64(limit))))
|
||||
@@ -361,7 +361,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func profile(for userID: String) async -> Result<UserProfile, ClientProxyError> {
|
||||
func profile(for userID: String) async -> Result<UserProfileProxy, ClientProxyError> {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
do {
|
||||
return try .success(.init(sdkUserProfile: self.client.getProfile(userId: userID)))
|
||||
|
||||
@@ -110,7 +110,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
|
||||
func setPusher(with configuration: PusherConfiguration) async throws
|
||||
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError>
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError>
|
||||
|
||||
func profile(for userID: String) async -> Result<UserProfile, ClientProxyError>
|
||||
func profile(for userID: String) async -> Result<UserProfileProxy, ClientProxyError>
|
||||
}
|
||||
|
||||
@@ -127,14 +127,14 @@ class MockClientProxy: ClientProxyProtocol {
|
||||
setPusherArgument = configuration
|
||||
}
|
||||
|
||||
var searchUsersResult: Result<SearchUsersResults, ClientProxyError> = .success(.init(results: [], limited: false))
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError> {
|
||||
var searchUsersResult: Result<SearchUsersResultsProxy, ClientProxyError> = .success(.init(results: [], limited: false))
|
||||
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError> {
|
||||
searchUsersResult
|
||||
}
|
||||
|
||||
var getProfileResult: Result<UserProfile, ClientProxyError> = .success(.init(userID: "@a:b.com", displayName: "Some user"))
|
||||
var getProfileResult: Result<UserProfileProxy, ClientProxyError> = .success(.init(userID: "@a:b.com", displayName: "Some user"))
|
||||
private(set) var getProfileCalled = false
|
||||
func profile(for userID: String) async -> Result<UserProfile, ClientProxyError> {
|
||||
func profile(for userID: String) async -> Result<UserProfileProxy, ClientProxyError> {
|
||||
getProfileCalled = true
|
||||
return getProfileResult
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user