@@ -5,57 +5,57 @@ import MapboxNavigationNative_Private
55import Turf
66
77extension AlternativeRoute {
8- // public static func mock(
9- // mainRoute: Route = .mock(),
10- // alternativeRoute: Route = .mock(shape: .mock(delta: (0.01, -0.01))),
11- // nativeRouteAlternative: RouteAlternative? = nil,
12- // requestOptions: ResponseOptions? = nil,
13- // routeIndex: Int = 0
14- // ) -> Self {
15- // let nativeAlternative = nativeRouteAlternative ?? .mock(
16- // mainRoute: mainRoute,
17- // alternativeRoute: alternativeRoute,
18- // routeIndex: routeIndex
19- // )
20- // let urlString = nativeAlternative.route.getRequestUri()
21- // let requestOptions = requestOptions ?? .mock(routeOptions: .mock(string: urlString))
22- // return self.init(
23- // mainRoute: mainRoute,
24- // alternativeRoute: alternativeRoute,
25- // nativeRouteAlternative: nativeAlternative,
26- // requestOptions: requestOptions
27- // )!
28- // }
8+ public static func mock(
9+ mainRoute: Route = . mock( ) ,
10+ alternativeRoute: Route = . mock( shape: . mock( delta: ( 0.01 , - 0.01 ) ) ) ,
11+ nativeRouteAlternative: RouteAlternative ? = nil ,
12+ requestOptions: ResponseOptions ? = nil ,
13+ routeIndex: Int = 0
14+ ) -> Self {
15+ let nativeAlternative = nativeRouteAlternative ?? . mock(
16+ mainRoute: mainRoute,
17+ alternativeRoute: alternativeRoute,
18+ routeIndex: routeIndex
19+ )
20+ let urlString = nativeAlternative. route. getRequestUri ( )
21+ let requestOptions = requestOptions ?? . mock( routeOptions: . mock( string: urlString) )
22+ return self . init (
23+ mainRoute: mainRoute,
24+ alternativeRoute: alternativeRoute,
25+ nativeRouteAlternative: nativeAlternative,
26+ requestOptions: requestOptions
27+ ) !
28+ }
2929}
3030
3131extension RouteAlternative {
32- // public static func mock(mainRoute: Route, alternativeRoute: Route, routeIndex: Int = 0) -> Self {
33- // .mock(route: RouteInterfaceMock(
34- // route: mainRoute,
35- // alternativeRoute: alternativeRoute,
36- // routeIndex: routeIndex
37- // ))
38- // }
39- //
40- // public static func mock(
41- // id: UInt32 = 0,
42- // route: RouteInterface = RouteInterfaceMock(),
43- // mainRouteFork: RouteIntersection = .mock(),
44- // alternativeRouteFork: RouteIntersection = .mock(),
45- // infoFromFork: AlternativeRouteInfo = .mock(),
46- // infoFromStart: AlternativeRouteInfo = .mock(),
47- // isNew: Bool = true
48- // ) -> Self {
49- // self.init(
50- // id: id,
51- // route: route,
52- // mainRouteFork: mainRouteFork,
53- // alternativeRouteFork: alternativeRouteFork,
54- // infoFromFork: infoFromFork,
55- // infoFromStart: infoFromStart,
56- // isNew: isNew
57- // )
58- // }
32+ public static func mock( mainRoute: Route , alternativeRoute: Route , routeIndex: Int = 0 ) -> Self {
33+ . mock( route: RouteInterfaceMock (
34+ route: mainRoute,
35+ alternativeRoute: alternativeRoute,
36+ routeIndex: routeIndex
37+ ) )
38+ }
39+
40+ public static func mock(
41+ id: UInt32 = 0 ,
42+ route: RouteInterface = RouteInterfaceMock ( ) ,
43+ mainRouteFork: RouteIntersection = . mock( ) ,
44+ alternativeRouteFork: RouteIntersection = . mock( ) ,
45+ infoFromFork: AlternativeRouteInfo = . mock( ) ,
46+ infoFromStart: AlternativeRouteInfo = . mock( ) ,
47+ isNew: Bool = true
48+ ) -> Self {
49+ self . init (
50+ id: id,
51+ route: route,
52+ mainRouteFork: mainRouteFork,
53+ alternativeRouteFork: alternativeRouteFork,
54+ infoFromFork: infoFromFork,
55+ infoFromStart: infoFromStart,
56+ isNew: isNew
57+ )
58+ }
5959}
6060
6161extension RouteIntersection {
0 commit comments