mirror of
https://github.com/mas-cli/mas
synced 2025-02-16 12:38:30 +00:00
♻️ Remove loadDataSync
This commit is contained in:
parent
25045fa0dd
commit
c3ef7b40b7
2 changed files with 2 additions and 10 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue