@@ -2,7 +2,7 @@ import XCTest
22import CoreLocation
33import MapboxDirections
44import Turf
5- import TestHelper
5+ @ testable import TestHelper
66@testable import MapboxCoreNavigation
77import OHHTTPStubs
88
@@ -181,16 +181,16 @@ fileprivate extension NavigationRouteOptions {
181181 static func mockedCustomOptions(
182182 _ profile: ProfileIdentifier
183183 ) -> NavigationRouteOptions {
184- CustomRouteOptions (
184+ let options = CustomRouteOptions (
185185 waypoints: [
186186 . init( coordinate: . origin) ,
187187 . init( coordinate: . destiantion) ,
188188 ] ,
189- profileIdentifier: profile,
190- customParameters: [ . customItem]
189+ profileIdentifier: profile
191190 )
191+ options. custom = URLQueryItem . customItem. value
192+ return options
192193 }
193-
194194}
195195
196196fileprivate extension RouteResponse {
@@ -246,44 +246,8 @@ fileprivate extension ProfileIdentifier {
246246}
247247
248248fileprivate extension URLQueryItem {
249- static let customItem : URLQueryItem = . init( name: " foo " , value: " bar " )
250- }
251-
252- fileprivate final class CustomRouteOptions : NavigationRouteOptions {
253- var customParameters : [ URLQueryItem ]
254-
255- init (
256- waypoints: [ Waypoint ] ,
257- profileIdentifier: ProfileIdentifier ? = nil ,
258- customParameters: [ URLQueryItem ] = [ ]
259- ) {
260- self . customParameters = customParameters
261-
262- super. init ( waypoints: waypoints, profileIdentifier: profileIdentifier)
263- }
264-
265- required init (
266- waypoints: [ Waypoint ] ,
267- profileIdentifier: ProfileIdentifier ? = nil ,
268- queryItems: [ URLQueryItem ] ? = nil
269- ) {
270- let mappedUrlItem = queryItems? . first ( where: { $0 == . customItem } )
271- self . customParameters = mappedUrlItem. map { [ $0] } ?? [ ]
272- super. init (
273- waypoints: waypoints,
274- profileIdentifier: profileIdentifier,
275- queryItems: queryItems
276- )
277- }
278-
279- required init ( from decoder: any Decoder ) throws {
280- self . customParameters = [ ]
281- try super. init ( from: decoder)
282- }
283-
284- override var urlQueryItems : [ URLQueryItem ] {
285- var combined = super. urlQueryItems
286- combined. append ( contentsOf: customParameters)
287- return combined
288- }
249+ static let customItem : URLQueryItem = . init(
250+ name: CustomRouteOptions . CodingKeys. custom. stringValue,
251+ value: " foobar "
252+ )
289253}
0 commit comments