Siri: Directions to Cheapest [fuel] AppShortcuts — OpenURLIntent hands off to Apple Maps (universal link)

This commit is contained in:
FuelBoard Contributor
2026-08-14 13:55:03 +01:00
parent a3b6f37843
commit caadf184f2
3 changed files with 127 additions and 0 deletions
@@ -470,6 +470,21 @@ final class SiriCheapestLookupTests: XCTestCase {
XCTAssertNil(SiriCheapestLookup.cheapest(in: [], fuel: .e10, fromLat: 53.01, lng: -1.01, withinMiles: 5))
}
func testMapsURLIsUniversalAppleMapsLink() {
let url = SiriCheapestLookup.mapsURL(latitude: 53.7538, longitude: -1.8177)
XCTAssertEqual(url.scheme, "https")
XCTAssertEqual(url.host, "maps.apple.com")
XCTAssertEqual(url.query, "daddr=53.7538,-1.8177")
}
func testMapsURLUsesUniversalLinkNotCustomScheme() {
// OpenURLIntent only opens universal links a maps:// custom scheme
// would be rejected at runtime, so the https form is mandatory.
let url = SiriCheapestLookup.mapsURL(latitude: 0, longitude: 0)
XCTAssertEqual(url.scheme, "https", "custom schemes like maps:// must not be used")
XCTAssertTrue(url.absoluteString.hasPrefix("https://maps.apple.com/"))
}
func testFreshnessLabelUsesDataUpdatedStamp() {
let label = SiriCheapestLookup.freshnessLabel(
updated: "2026-08-14T10:31:36.000Z",