Skip to content

Commit

Permalink
2284: added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Kononov authored and 1ec5 committed Aug 31, 2020
1 parent 5e8e1df commit 73f6e42
Show file tree
Hide file tree
Showing 6 changed files with 2,688 additions and 1 deletion.
40 changes: 40 additions & 0 deletions MapboxDirections.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
2B5407F8245302AB006C820B /* RouteLegAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407F6245302AB006C820B /* RouteLegAnnotation.swift */; };
2B5407F9245302AB006C820B /* RouteLegAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407F6245302AB006C820B /* RouteLegAnnotation.swift */; };
2B5407FA245302AB006C820B /* RouteLegAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407F6245302AB006C820B /* RouteLegAnnotation.swift */; };
2B5407FC245B070A006C820B /* RouteRefreshTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407FB245B070A006C820B /* RouteRefreshTests.swift */; };
2B5407FD245B070A006C820B /* RouteRefreshTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407FB245B070A006C820B /* RouteRefreshTests.swift */; };
2B5407FE245B070A006C820B /* RouteRefreshTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B5407FB245B070A006C820B /* RouteRefreshTests.swift */; };
2B540800245B097D006C820B /* routeRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B5407FF245B097D006C820B /* routeRefreshResponse.json */; };
2B540801245B097D006C820B /* routeRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B5407FF245B097D006C820B /* routeRefreshResponse.json */; };
2B540802245B097D006C820B /* routeRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B5407FF245B097D006C820B /* routeRefreshResponse.json */; };
2B540805245B09E1006C820B /* routeRefreshRoute.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540804245B09E1006C820B /* routeRefreshRoute.json */; };
2B540806245B09E1006C820B /* routeRefreshRoute.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540804245B09E1006C820B /* routeRefreshRoute.json */; };
2B540807245B09E1006C820B /* routeRefreshRoute.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540804245B09E1006C820B /* routeRefreshRoute.json */; };
2B540809245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540808245B23BE006C820B /* incorrectRouteRefreshResponse.json */; };
2B54080A245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540808245B23BE006C820B /* incorrectRouteRefreshResponse.json */; };
2B54080B245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 2B540808245B23BE006C820B /* incorrectRouteRefreshResponse.json */; };
35828C9E217A003F00ED546E /* OfflineDirections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35828C9D217A003F00ED546E /* OfflineDirections.swift */; };
35828C9F217A003F00ED546E /* OfflineDirections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35828C9D217A003F00ED546E /* OfflineDirections.swift */; };
35828CA0217A003F00ED546E /* OfflineDirections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35828C9D217A003F00ED546E /* OfflineDirections.swift */; };
Expand Down Expand Up @@ -368,6 +380,10 @@
2B5407EC2451B17E006C820B /* RouteRefreshResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteRefreshResponse.swift; sourceTree = "<group>"; };
2B5407F12452FA8C006C820B /* RefreshedRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshedRoute.swift; sourceTree = "<group>"; };
2B5407F6245302AB006C820B /* RouteLegAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteLegAnnotation.swift; sourceTree = "<group>"; };
2B5407FB245B070A006C820B /* RouteRefreshTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteRefreshTests.swift; sourceTree = "<group>"; };
2B5407FF245B097D006C820B /* routeRefreshResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = routeRefreshResponse.json; sourceTree = "<group>"; };
2B540804245B09E1006C820B /* routeRefreshRoute.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = routeRefreshRoute.json; sourceTree = "<group>"; };
2B540808245B23BE006C820B /* incorrectRouteRefreshResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = incorrectRouteRefreshResponse.json; sourceTree = "<group>"; };
3556CE9922649CF2009397B5 /* MapboxDirectionsTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "MapboxDirectionsTests-Bridging-Header.h"; path = "../objc/MapboxDirectionsTests-Bridging-Header.h"; sourceTree = "<group>"; };
35828C9D217A003F00ED546E /* OfflineDirections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OfflineDirections.swift; sourceTree = "<group>"; };
35CC310A2285739700EA1966 /* WalkingOptionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkingOptionsTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -551,6 +567,16 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
2B540803245B09B2006C820B /* RouteRefresh */ = {
isa = PBXGroup;
children = (
2B5407FF245B097D006C820B /* routeRefreshResponse.json */,
2B540808245B23BE006C820B /* incorrectRouteRefreshResponse.json */,
2B540804245B09E1006C820B /* routeRefreshRoute.json */,
);
path = RouteRefresh;
sourceTree = "<group>";
};
35DBF017217F387F0009D2AE /* Offline */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -710,6 +736,7 @@
3556CE9922649CF2009397B5 /* MapboxDirectionsTests-Bridging-Header.h */,
C5DAACAE201AA92B001F9261 /* MatchTests.swift */,
35DBF013217E199E0009D2AE /* OfflineDirectionsTests.swift */,
2B5407FB245B070A006C820B /* RouteRefreshTests.swift */,
DAE2DF6723AECB120065057A /* QuickLookTests.swift */,
C59666382048A20E00C45CE5 /* RoutableMatchTests.swift */,
DAE2DF6B23AED2280065057A /* RouteTests.swift */,
Expand All @@ -733,6 +760,7 @@
DA6C9DAD1CAEC93800094FBC /* Fixtures */ = {
isa = PBXGroup;
children = (
2B540803245B09B2006C820B /* RouteRefresh */,
35DBF017217F387F0009D2AE /* Offline */,
C5DAACB2201AA97D001F9261 /* Match */,
8D381B5F1FD9F592008D5A58 /* Responses */,
Expand Down Expand Up @@ -1102,15 +1130,18 @@
files = (
DA737EE51D05F91E005BDA16 /* v5_driving_dc_geojson.json in Resources */,
DA1A10CF1D00F975009F82FA /* v5_driving_dc_polyline.json in Resources */,
2B54080A245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */,
C5C0D63520586419003A3B1D /* null-tracepoint.json in Resources */,
AEAB390E20D7F508008F4E54 /* subLaneInstructions.json in Resources */,
DAD31BC424D4ADBF00A1654D /* match-polyline6.json in Resources */,
C5D1D7F11F6AF92500A1C4F1 /* instructions.json in Resources */,
8D381B661FDB089E008D5A58 /* apiDestinationName.json in Resources */,
8D381B641FDB0898008D5A58 /* noDestinationName.json in Resources */,
2B540801245B097D006C820B /* routeRefreshResponse.json in Resources */,
35DBF01A217F38A30009D2AE /* versions.json in Resources */,
35D92FF1218203AB000C78CB /* 2018-10-16-Liechtenstein.tar in Resources */,
AEAB391220D9469A008F4E54 /* subVisualInstructions.json in Resources */,
2B540806245B09E1006C820B /* routeRefreshRoute.json in Resources */,
DACCFCAA2225359600110FC9 /* v5_driving_oldenburg_polyline.json in Resources */,
C5DAACB5201AA9A7001F9261 /* match.json in Resources */,
C53A022B1E92C281009837BD /* annotation.json in Resources */,
Expand All @@ -1130,15 +1161,18 @@
files = (
DA737EE61D05F91E005BDA16 /* v5_driving_dc_geojson.json in Resources */,
DA1A10F31D010251009F82FA /* v5_driving_dc_polyline.json in Resources */,
2B54080B245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */,
C5C0D6362058641B003A3B1D /* null-tracepoint.json in Resources */,
AEAB390F20D7F50A008F4E54 /* subLaneInstructions.json in Resources */,
DAD31BC524D4ADC000A1654D /* match-polyline6.json in Resources */,
C5D1D7F21F6AF92600A1C4F1 /* instructions.json in Resources */,
8D381B671FDB089F008D5A58 /* apiDestinationName.json in Resources */,
8D381B651FDB0899008D5A58 /* noDestinationName.json in Resources */,
2B540802245B097D006C820B /* routeRefreshResponse.json in Resources */,
35DBF01B217F38A30009D2AE /* versions.json in Resources */,
35D92FF2218203AB000C78CB /* 2018-10-16-Liechtenstein.tar in Resources */,
AEAB391320D9469A008F4E54 /* subVisualInstructions.json in Resources */,
2B540807245B09E1006C820B /* routeRefreshRoute.json in Resources */,
DACCFCAB2225359600110FC9 /* v5_driving_oldenburg_polyline.json in Resources */,
C5DAACB6201AA9A7001F9261 /* match.json in Resources */,
C53A022C1E92C281009837BD /* annotation.json in Resources */,
Expand All @@ -1165,15 +1199,18 @@
files = (
DA737EE41D05F91E005BDA16 /* v5_driving_dc_geojson.json in Resources */,
DAC05F1C1CFC1E5300FA0071 /* v5_driving_dc_polyline.json in Resources */,
2B540809245B23BE006C820B /* incorrectRouteRefreshResponse.json in Resources */,
C5C0D6342058523E003A3B1D /* null-tracepoint.json in Resources */,
AEAB390D20D7F4F4008F4E54 /* subLaneInstructions.json in Resources */,
DAD31BC324D4ADBF00A1654D /* match-polyline6.json in Resources */,
C5D1D7F01F6AF91700A1C4F1 /* instructions.json in Resources */,
8D381B611FD9F5B1008D5A58 /* noDestinationName.json in Resources */,
35DBF019217F38A30009D2AE /* versions.json in Resources */,
2B540800245B097D006C820B /* routeRefreshResponse.json in Resources */,
35D92FF0218203AB000C78CB /* 2018-10-16-Liechtenstein.tar in Resources */,
AEAB391120D9469A008F4E54 /* subVisualInstructions.json in Resources */,
DACCFCA92225359600110FC9 /* v5_driving_oldenburg_polyline.json in Resources */,
2B540805245B09E1006C820B /* routeRefreshRoute.json in Resources */,
C5DAACB4201AA9A7001F9261 /* match.json in Resources */,
C5A3D3981E8188FE00D494A0 /* annotation.json in Resources */,
8D381B631FDB01D1008D5A58 /* apiDestinationName.json in Resources */,
Expand Down Expand Up @@ -1297,6 +1334,7 @@
DA8F3A7323B56D3B00B56786 /* RouteLegTests.swift in Sources */,
DA1A10CD1D00F972009F82FA /* V5Tests.swift in Sources */,
DAE33A1C1F215DF600C06039 /* IntersectionTests.swift in Sources */,
2B5407FD245B070A006C820B /* RouteRefreshTests.swift in Sources */,
C5DAACB0201AA92B001F9261 /* MatchTests.swift in Sources */,
DA1A10CE1D00F972009F82FA /* Fixture.swift in Sources */,
DAE2DF6923AECB120065057A /* QuickLookTests.swift in Sources */,
Expand Down Expand Up @@ -1378,6 +1416,7 @@
DA8F3A7423B56D3B00B56786 /* RouteLegTests.swift in Sources */,
DA1A10F41D010251009F82FA /* V5Tests.swift in Sources */,
DAE33A1D1F215DF600C06039 /* IntersectionTests.swift in Sources */,
2B5407FE245B070A006C820B /* RouteRefreshTests.swift in Sources */,
C5DAACB1201AA92B001F9261 /* MatchTests.swift in Sources */,
DA1A10F51D010251009F82FA /* Fixture.swift in Sources */,
DAE2DF6A23AECB120065057A /* QuickLookTests.swift in Sources */,
Expand Down Expand Up @@ -1509,6 +1548,7 @@
DA6C9DAC1CAEC72800094FBC /* V5Tests.swift in Sources */,
8A3B4C9B24EB55F60085DA64 /* RouteResponseTests.swift in Sources */,
DAE33A1B1F215DF600C06039 /* IntersectionTests.swift in Sources */,
2B5407FC245B070A006C820B /* RouteRefreshTests.swift in Sources */,
C5DAACAF201AA92B001F9261 /* MatchTests.swift in Sources */,
DA6C9DB21CAECA0E00094FBC /* Fixture.swift in Sources */,
DAE2DF6823AECB120065057A /* QuickLookTests.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion Sources/MapboxDirections/Directions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ open class Directions: NSObject {

open func urlRequest(forRefreshing routeId: String, routeIndex: Int, currentLegIndex: Int) -> URLRequest {
var params: [URLQueryItem] = []
// directions-refresh/v1/mapbox/driving-traffic/{request_id}/{route_index}/{leg_index}
params += [URLQueryItem(name: "access_token", value: credentials.accessToken)]

var unparameterizedURL = URL(string: "directions-refresh/v1/\(DirectionsProfileIdentifier.automobileAvoidingTraffic.rawValue)", relativeTo: credentials.host)!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "<route_id> at index 0 not found.",
"code": "InvalidInput"
}
Loading

0 comments on commit 73f6e42

Please sign in to comment.