mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +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:
@@ -29,7 +29,7 @@ class UserDiscoveryServiceTest: XCTestCase {
|
||||
}
|
||||
|
||||
func testQueryShowingResults() async throws {
|
||||
clientProxy.searchUsersResult = .success(.init(results: [UserProfile.mockAlice], limited: true))
|
||||
clientProxy.searchUsersResult = .success(.init(results: [UserProfileProxy.mockAlice], limited: true))
|
||||
|
||||
let results = await (try? search(query: "AAA").get()) ?? []
|
||||
assertSearchResults(results, toBe: 1)
|
||||
@@ -79,17 +79,17 @@ class UserDiscoveryServiceTest: XCTestCase {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func assertSearchResults(_ results: [UserProfile], toBe count: Int) {
|
||||
private func assertSearchResults(_ results: [UserProfileProxy], toBe count: Int) {
|
||||
XCTAssertTrue(count >= 0)
|
||||
XCTAssertEqual(results.count, count)
|
||||
XCTAssertEqual(results.isEmpty, count == 0)
|
||||
}
|
||||
|
||||
private func search(query: String) async -> Result<[UserProfile], UserDiscoveryErrorType> {
|
||||
private func search(query: String) async -> Result<[UserProfileProxy], UserDiscoveryErrorType> {
|
||||
await service.searchProfiles(with: query)
|
||||
}
|
||||
|
||||
private var searchResults: [UserProfile] {
|
||||
private var searchResults: [UserProfileProxy] {
|
||||
[
|
||||
.mockAlice,
|
||||
.mockBob,
|
||||
|
||||
Reference in New Issue
Block a user