road distance: cover all in-radius stations, not just nearest 12
Stations past the nearest-12 cutoff silently fell back to straight-line, which explained the remaining app-vs-Apple-Maps gaps (e.g. 3.5 straight-line vs 5.9 road). Raise the per-pass cap to 40 and route every station within a 25 km straight-line radius (covers the 15 mi max search window) so any station the widget/Live Activity/list can show gets a real road distance. Also harden the new cache tests against persistent keychain state across invocations (reset in setUp) so they pass deterministically.
This commit is contained in:
@@ -624,6 +624,14 @@ final class OfflineDataLabelTests: XCTestCase {
|
||||
// MARK: - Road distance cache
|
||||
|
||||
final class RoadDistanceCacheTests: XCTestCase {
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Keychain persists across invocations, so a cache left by an earlier
|
||||
// test or run would pollute these. Overwrite with an empty, far-away
|
||||
// cache (source at (0,0)) so every test starts from a clean slate.
|
||||
FuelStore.saveRoadDistances(sourceLat: 0, sourceLng: 0, entries: [:])
|
||||
}
|
||||
|
||||
private func station(_ id: String, _ lat: Double, _ lng: Double) -> FuelStation {
|
||||
FuelStation(id: id, name: id, brand: "X", address: "", postcode: "",
|
||||
lat: lat, lng: lng, prices: [:], priceUpdated: nil)
|
||||
|
||||
Reference in New Issue
Block a user