mapbox / mapbox/mapbox-directions-swift
Create a mock for "Route" entity for Unit Testing
- Dominant language
- Swift
- Stars
- 206
- Forks
- 99
- Avg merge
- 7h 54m
- Merged PRs (30d)
- 3
Description
'MapboxDirections.swift', '0.27.3'
I'm writing unit tests for a class that uses a dependency that should return at least one "Route" entity.
For the dependency class, I created a new class by subclassing, and on completion block I want to return a mock object for "Route", but during build time for unit tests I get those issues:
> :-1: Undefined symbol: type metadata accessor for MapboxDirections.Route
> :-1: Undefined symbol: MapboxDirections.Waypoint.__allocating_init(coordinate: __C.CLLocationCoordinate2D, coordinateAccuracy: Swift.Double, name: Swift.String?) -> MapboxDirections.Waypoint
> :-1: Undefined symbol: type metadata accessor for MapboxCoreNavigation.NavigationMatchOptions
> :-1: Undefined symbol: MapboxCoreNavigation.NavigationMatchOptions.__allocating_init(waypoints: [MapboxDirections.Waypoint], profileIdentifier: __C.MBDirectionsProfileIdentifier?) -> MapboxCoreNavigation.NavigationMatchOptions
> :-1: Undefined symbol: type metadata accessor for MapboxDirections.Waypoint
> :-1: Undefined symbol: _MBDirectionsProfileIdentifierAutomobile
> :-1: Undefined symbol: MapboxDirections.Directions.shared.unsafeMutableAddressor : MapboxDirections.Directions
Contributor guide
Research direction
Start with MapboxDirections.swift and the unit-test target to determine how Route, Waypoint, and NavigationMatchOptions are exposed for tests. Reproduce the listed undefined-symbol errors, then verify that a mock Route can be returned by a subclassed dependency and the unit-test target links successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100