maplibre / maplibre-navigation-ios

MapLibre Navigation SDK for iOS
Other
36 stars 29 forks source link

Strange things in NavigationViewControllerTests that seem not to be testing anything. #46

Open michaelkirk opened 4 months ago

michaelkirk commented 4 months ago

There are a few tests that seem to be in pursuit of making sure the stylemanager switches style when appropriate (and only when appropriate).

I noted this while working on some adjacent code, and it was requested I make an issue with my findings.

Weird things:

  1. There's a test about tunnel travel, but it doesn't look like the route goes through any tunnel.

  2. strange movement simulation. I'm assuming the following code was intended to simulate travel by updating the location along the route:

    routeController.locationManager(routeController.locationManager, didUpdateLocations: [someLocation])
    routeController.locationManager(routeController.locationManager, didUpdateLocations: [someLocation])
    routeController.locationManager(routeController.locationManager, didUpdateLocations: [someLocation])

But why is it using the same location all three times? I'd expect each call to be a further point along the route.

  1. There are several tests that check that the style has not changed after certain actions, but the actions seems incoherent (see point 2.), and there is no test to checks the positive condition that the style has ever changed, so I'm not confident that any of the expected code is being tested.

  2. Some variables have misleading names - they seem to have nothing to do with actual intersections along the route. There's no taylorStreet, turkStreet, or fultonStreet at these points. I wonder if the underlying route changed at some point? It's a minor thing but it added to my confusion.

    let taylorStreetIntersection = routeController.routeProgress.route.legs.first!.steps.first!.intersections!.first!
    let turkStreetIntersection = routeController.routeProgress.route.legs.first!.steps[3].intersections!.first!
    let fultonStreetIntersection = routeController.routeProgress.route.legs.first!.steps[5].intersections!.first!