Skip to content

Commit

Permalink
Excluding cash tolls roads fix (#801)
Browse files Browse the repository at this point in the history
* vk-779-tolls-exclude-fix: correct cashTollOnly string value mistype; CHANGELOG updated
  • Loading branch information
Udumft committed Feb 24, 2023
1 parent e8f8662 commit 475cbf3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added `Matrix` API wrapper. The [Mapbox Matrix API](https://docs.mapbox.com/api/navigation/matrix/) computes travel times between many points, and returns a matrix of all travel times between the locations. [#626](https://github.com/mapbox/mapbox-directions-swift/pull/626)
* Fixed a crash that could occur if only one `Waypoint` with a nonnull `name` was used in the Directions request. [#797](https://github.com/mapbox/mapbox-directions-swift/pull/797)
* Added `Interchange` and `Junction` structs describing IC and JCT. [#799](https://github.com/mapbox/mapbox-directions-swift/pull/799)
* Fixed an issue where using `cashTollOnly` for road class exclusions failed the directions request. ([#801](https://github.com/mapbox/mapbox-directions-swift/pull/801))

## v2.9.0

Expand Down
4 changes: 2 additions & 2 deletions Sources/MapboxDirections/RoadClasses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public struct RoadClasses: OptionSet, CustomStringConvertible {
roadClasses.insert(.highOccupancyToll)
case "unpaved":
roadClasses.insert(.unpaved)
case "cash_only_toll":
case "cash_only_tolls":
roadClasses.insert(.cashTollOnly)
case "":
continue
Expand Down Expand Up @@ -162,7 +162,7 @@ public struct RoadClasses: OptionSet, CustomStringConvertible {
descriptions.append("unpaved")
}
if contains(.cashTollOnly) {
descriptions.append("cash_only_toll")
descriptions.append("cash_only_tolls")
}
return descriptions.joined(separator: ",")
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/MapboxDirectionsTests/RouteOptionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class RouteOptionsTests: XCTestCase {
options.roadClassesToAvoid = [.toll, .motorway, .ferry, .unpaved, .cashTollOnly]
options.roadClassesToAllow = [.highOccupancyVehicle2, .highOccupancyVehicle3, .highOccupancyToll]

let expectedExcludeQueryItem = URLQueryItem(name: "exclude", value: "toll,motorway,ferry,unpaved,cash_only_toll")
let expectedExcludeQueryItem = URLQueryItem(name: "exclude", value: "toll,motorway,ferry,unpaved,cash_only_tolls")
XCTAssertTrue(options.urlQueryItems.contains(expectedExcludeQueryItem))

let expectedIncludeQueryItem = URLQueryItem(name: "include", value: "hov2,hov3,hot")
Expand Down

0 comments on commit 475cbf3

Please sign in to comment.