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:
Mauro
2023-05-30 09:48:55 +02:00
committed by GitHub
parent 25e2b05a4a
commit 088ca622a1
39 changed files with 857 additions and 194 deletions
@@ -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,