Skip to content

Commit

Permalink
updated to latest Alamofire release, fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuchetics committed Sep 4, 2019
1 parent 7236503 commit a68f0ea
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Alamofire/Alamofire" "5.0.0-beta.6"
github "Alamofire/Alamofire" "5.0.0-rc.1"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "Alamofire/Alamofire" "5.0.0-beta.6"
github "Alamofire/Alamofire" "5.0.0-rc.1"
2 changes: 1 addition & 1 deletion Fetch/Code/Network/APIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public class APIClient {
.validate() // Validate response (status codes + content types)
.responseData(queue: self.decodingQueue, completionHandler: { (dataResponse) in
// Map and decode Data to Object
let decodedResponse = dataResponse.flatMap { (data) throws -> T in
let decodedResponse = dataResponse.tryMap { (data) throws -> T in
if T.self == IgnoreBody.self {
return IgnoreBody() as! T
} else {
Expand Down
4 changes: 2 additions & 2 deletions FetchTests/CustomValidationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class CustomValidationTests: XCTestCase {

resource.request { (result) in
switch result {
case .failure(.other(error: let otherError)):
XCTAssertEqual((otherError as? ValidationError), .wrongStatusCode)
case .failure(.network(let afError, _)):
XCTAssertEqual((afError.underlyingError as? ValidationError), .wrongStatusCode)
expectation.fulfill()
default:
XCTFail("Request did not return error")
Expand Down
11 changes: 8 additions & 3 deletions FetchTests/StubTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ class StubTests: XCTestCase {
case .success:
XCTFail("Request did not return error")
case .failure(let error):
if case .other(error: let otherError) = error {
XCTAssertEqual((otherError as NSError).domain, inputError.domain, "Same error domain as input")
XCTAssertEqual((otherError as NSError).code, inputError.code, "Same error code as input")
if case .network(let afError, _) = error {
guard let nsError = afError.underlyingError as NSError? else {
XCTFail("Expect error is not set")
return
}

XCTAssertEqual(nsError.domain, inputError.domain, "Same error domain as input")
XCTAssertEqual(nsError.code, inputError.code, "Same error code as input")
} else {
XCTFail("Expect error is not set")
}
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
.library(name: "Fetch", targets: ["Fetch"])
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0-beta.6"),
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0-rc.1")
],
targets: [
.target(name: "Fetch", dependencies: ["Alamofire"], path: "Fetch/Code")
Expand Down

0 comments on commit a68f0ea

Please sign in to comment.