Skip to content

Commit 1a62a27

Browse files
committed
Simplify mocks with result.get()
1 parent 5b2efe2 commit 1a62a27

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

Yosemite/YosemiteTests/Mocks/Networking/Remote/MockAccountRemote.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,7 @@ extension MockAccountRemote: AccountRemoteProtocol {
104104
throw NetworkError.notFound
105105
}
106106

107-
switch result {
108-
case let .success(suggestions):
109-
return suggestions
110-
case let .failure(error):
111-
throw error
112-
}
107+
return try result.get()
113108
}
114109

115110
func createAccount(email: String,

Yosemite/YosemiteTests/Mocks/Networking/Remote/MockDomainRemote.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ extension MockDomainRemote: DomainRemoteProtocol {
1919
XCTFail("Could not find result for loading domain suggestions.")
2020
throw NetworkError.notFound
2121
}
22-
switch result {
23-
case let .success(suggestions):
24-
return suggestions
25-
case let .failure(error):
26-
throw error
27-
}
22+
23+
return try result.get()
2824
}
2925
}

Yosemite/YosemiteTests/Mocks/Networking/Remote/MockSiteRemote.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ extension MockSiteRemote: SiteRemoteProtocol {
2020
throw NetworkError.notFound
2121
}
2222

23-
switch result {
24-
case let .success(response):
25-
return response
26-
case let .failure(error):
27-
throw error
28-
}
23+
return try result.get()
2924
}
3025
}

0 commit comments

Comments
 (0)