Skip to content

Commit

Permalink
Update DirectionsTests.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 authored Nov 21, 2018
1 parent eeebe93 commit 3a6919e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions MapboxDirectionsTests/DirectionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DirectionsTests: XCTestCase {
}

func testKnownBadResponse() {
let pass = "The operation couldn’t be completed. Request Entity Too Large"
let pass = "The operation couldn’t be completed. The request is too large."

OHHTTPStubs.stubRequests(passingTest: { (request) -> Bool in
return request.url!.absoluteString.contains("https://api.mapbox.com/directions")
Expand All @@ -56,9 +56,9 @@ class DirectionsTests: XCTestCase {
let opts = RouteOptions(locations: [one, two])
directions.calculate(opts, completionHandler: { (waypoints, routes, error) in
expectation.fulfill()
XCTAssert(routes == nil, "Unexpected route response")
XCTAssert(error != nil, "No error returned")
XCTAssert(error?.localizedDescription == pass, "Wrong type of error recieved")
XCTAssertNil(routes, "Unexpected route response")
XCTAssertNotNil(error, "No error returned")
XCTAssertEqual(error?.localizedDescription, pass, "Wrong type of error received")
})
wait(for: [expectation], timeout: 2.0)
}
Expand All @@ -80,9 +80,9 @@ class DirectionsTests: XCTestCase {
let opts = RouteOptions(locations: [one, two])
directions.calculate(opts, completionHandler: { (waypoints, routes, error) in
expectation.fulfill()
XCTAssert(routes == nil, "Unexpected route response")
XCTAssert(error != nil, "No error returned")
XCTAssert(error?.localizedDescription == pass, "Wrong type of error recieved")
XCTAssertNil(routes, "Unexpected route response")
XCTAssertNotNil(error, "No error returned")
XCTAssertEqual(error?.localizedDescription, pass, "Wrong type of error received")
})
wait(for: [expectation], timeout: 2.0)
}
Expand All @@ -101,6 +101,4 @@ class DirectionsTests: XCTestCase {
XCTAssertEqual(resultError.localizedFailureReason, "More than 600 requests have been made with this access token within a period of 1 minute.")
XCTAssertEqual(resultError.localizedRecoverySuggestion, "Wait until November 18, 2016 at 9:16:24 AM GMT before retrying.")
}


}

0 comments on commit 3a6919e

Please sign in to comment.