Skip to content

Commit e330df0

Browse files
committed
[Core] Integration tests in progress
1 parent cd9c4e2 commit e330df0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Tests/MapboxCoreNavigationIntegrationTests/RouteRefreshIntegrationTests.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ class RouteRefreshIntegrationTests: TestCase {
3232
}
3333

3434
func testRouteRefreshWithCustomDrivingTrafficProfile() {
35-
simulateAndTestOnRoute(with: .custom, shouldRefresh: true)
35+
simulateAndTestOnRoute(with: .customDrivingTraffic, shouldRefresh: true)
36+
}
37+
38+
func testRouteRefreshWithDefaultAutomobileProfile() {
39+
simulateAndTestOnRoute(with: .automobile, shouldRefresh: false)
3640
}
3741

3842
func testRouteRefreshWithWalkingProfile() {
@@ -49,10 +53,10 @@ class RouteRefreshIntegrationTests: TestCase {
4953

5054
func testReRouteCustomParametersCustomDrivingTrafficProfile() {
5155
simulateAndTestOffRoute(
52-
with: .mockedCustomOptions(.custom),
56+
with: .mockedCustomOptions(.customDrivingTraffic),
5357
expectationKey: "RerouteCustomParametersDefaultProfile") { options in
5458
let customOptions = options as! CustomRouteOptions
55-
XCTAssert(customOptions.profileIdentifier == .custom)
59+
XCTAssert(customOptions.profileIdentifier == .customDrivingTraffic)
5660
XCTAssert(customOptions.urlQueryItems.contains(.customItem))
5761
}
5862
}
@@ -238,7 +242,7 @@ fileprivate extension TimeInterval {
238242
}
239243

240244
fileprivate extension ProfileIdentifier {
241-
static let custom: ProfileIdentifier = .init(rawValue: "custom/driving-traffic")
245+
static let customDrivingTraffic: ProfileIdentifier = .init(rawValue: "custom/driving-traffic")
242246
}
243247

244248
fileprivate extension URLQueryItem {
@@ -263,8 +267,8 @@ fileprivate final class CustomRouteOptions: NavigationRouteOptions {
263267
profileIdentifier: ProfileIdentifier? = nil,
264268
queryItems: [URLQueryItem]? = nil
265269
) {
266-
let mappedUrlItem = queryItems!.first(where: { $0 == .customItem })!
267-
self.customParameters = [mappedUrlItem]
270+
let mappedUrlItem = queryItems?.first(where: { $0 == .customItem })
271+
self.customParameters = mappedUrlItem.map { [$0] } ?? []
268272
super.init(
269273
waypoints: waypoints,
270274
profileIdentifier: profileIdentifier,

0 commit comments

Comments
 (0)