Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Kladek committed Apr 15, 2024
1 parent 926e394 commit a6278c6
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions MapboxNavigationTests/Sources/Support/Fixture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,22 @@ import MapboxDirections
import XCTest

extension Fixture {
class func downloadRouteFixture(coordinates: [CLLocationCoordinate2D], fileName: String, completion: @escaping () -> Void) {
let accessToken = "<# Mapbox Access Token #>"
let directions = Directions(accessToken: accessToken)

let options = RouteOptions(coordinates: coordinates, profileIdentifier: .automobileAvoidingTraffic)
options.includesSteps = true
options.routeShapeResolution = .full
let filePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(fileName)

_ = directions.calculate(options, completionHandler: { _, routes, _ in
guard let route = routes?.first else { return }

NSKeyedArchiver.archiveRootObject(route, toFile: filePath)
print("Route downloaded to \(filePath)")
completion()
})
}

class var blankStyle: URL {
let path = Bundle.module.path(forResource: "EmptyStyle", ofType: "json")
return URL(fileURLWithPath: path!)
}


class func routeWithBannerInstructions() -> Route {
route(from: "route-with-banner-instructions", bundle: .module, waypoints: [Waypoint(coordinate: CLLocationCoordinate2D(latitude: 37.795042, longitude: -122.413165)), Waypoint(coordinate: CLLocationCoordinate2D(latitude: 37.7727, longitude: -122.433378))])
}
}

// MARK: - Private

private extension Fixture {
class func route(from jsonFile: String, bundle: Bundle, waypoints: [Waypoint]) -> Route {
let response = JSONFromFileNamed(name: jsonFile, bundle: bundle)
let jsonRoute = (response["routes"] as! [AnyObject]).first as! [String: Any]
return Route(json: jsonRoute, waypoints: waypoints, options: RouteOptions(waypoints: waypoints))
}

class func routeWithBannerInstructions() -> Route {
route(from: "route-with-banner-instructions", bundle: .module, waypoints: [Waypoint(coordinate: CLLocationCoordinate2D(latitude: 37.795042, longitude: -122.413165)), Waypoint(coordinate: CLLocationCoordinate2D(latitude: 37.7727, longitude: -122.433378))])
}
}

0 comments on commit a6278c6

Please sign in to comment.