♻️ Remove loadDataSync

This commit is contained in:
Chris Araman 2021-05-08 10:17:43 -07:00
parent 25045fa0dd
commit c3ef7b40b7
No known key found for this signature in database
GPG key ID: BB4499D9E11B61E0
2 changed files with 2 additions and 10 deletions

View file

@ -34,12 +34,4 @@ class NetworkManager {
func loadData(from url: URL) -> Promise<Data> {
session.loadData(from: url)
}
/// Loads data synchronously.
///
/// - Parameter url: URL to load data from.
/// - Returns: The Data of the response.
func loadDataSync(from url: URL) throws -> Data {
try session.loadData(from: url).wait()
}
}

View file

@ -46,7 +46,7 @@ class NetworkManagerTests: XCTestCase {
let url = URL(fileURLWithPath: "url")
// Perform the request and verify the result
let result = try manager.loadDataSync(from: url)
let result = try manager.loadData(from: url).wait()
XCTAssertEqual(result, data)
}
@ -82,7 +82,7 @@ class NetworkManagerTests: XCTestCase {
let url = URL(fileURLWithPath: "url")
// Perform the request and verify the result
XCTAssertThrowsError(try manager.loadDataSync(from: url)) { error in
XCTAssertThrowsError(try manager.loadData(from: url).wait()) { error in
guard let error = error as? MASError else {
XCTFail("Error is of unexpected type.")
return