@@ -518,31 +518,38 @@ class InAppHelperTests: XCTestCase {
518
518
}
519
519
520
520
// nil host
521
- func testCallbackUrlParsingCustomScheme1 ( ) {
521
+ func testCallbackUrlParsingAppleWebdataScheme1 ( ) {
522
522
let url = URL ( string: " applewebdata:// " ) !
523
- XCTAssertNil ( InAppHelper . getCallbackAndDestinationUrl ( url : url) )
523
+ XCTAssertNil ( InAppHelper . parse ( inAppUrl : url) )
524
524
}
525
525
526
526
527
- func testCallbackUrlParsingCustomScheme2 ( ) {
527
+ func testCallbackUrlParsingAppleWebdataScheme2 ( ) {
528
528
let url = URL ( string: " applewebdata://this-is-uuid/the-real-url " ) !
529
- let ( callbackUrl, destinationUrl) = InAppHelper . getCallbackAndDestinationUrl ( url: url) !
530
- XCTAssertEqual ( callbackUrl, " the-real-url " )
531
- XCTAssertEqual ( destinationUrl, " the-real-url " )
529
+ let parsed = InAppHelper . parse ( inAppUrl: url) !
530
+ if case let InAppHelper . InAppClickedUrl . localResource( name: name) = parsed {
531
+ XCTAssertEqual ( name, " the-real-url " )
532
+ } else {
533
+ XCTFail ( " could not parse " )
534
+ }
532
535
}
533
536
534
- func testCallbackUrlParsingIterableScheme( ) {
535
- let url = URL ( string: " itbl://buyProduct " ) !
536
- let ( callbackUrl, destinationUrl) = InAppHelper . getCallbackAndDestinationUrl ( url: url) !
537
- XCTAssertEqual ( callbackUrl, " buyProduct " )
538
- XCTAssertEqual ( destinationUrl, " itbl://buyProduct " )
537
+ func testCallbackUrlParsingCustomActionScheme( ) {
538
+ let url = URL ( string: " action://buyProduct " ) !
539
+ if case let InAppHelper . InAppClickedUrl . customAction( name: name) = InAppHelper . parse ( inAppUrl: url) ! {
540
+ XCTAssertEqual ( name, " buyProduct " )
541
+ } else {
542
+ XCTFail ( " Could not parse " )
543
+ }
539
544
}
540
545
541
546
func testCallbackUrlParsingRegularScheme( ) {
542
547
let url = URL ( string: " https://host/path " ) !
543
- let ( callbackUrl, destinationUrl) = InAppHelper . getCallbackAndDestinationUrl ( url: url) !
544
- XCTAssertEqual ( callbackUrl, " https://host/path " )
545
- XCTAssertEqual ( destinationUrl, " https://host/path " )
548
+ if case let InAppHelper . InAppClickedUrl . regularUrl( parsedUrl) = InAppHelper . parse ( inAppUrl: url) ! {
549
+ XCTAssertEqual ( parsedUrl, url)
550
+ } else {
551
+ XCTFail ( " Could not parse " )
552
+ }
546
553
}
547
554
548
555
private static let apiKey = " zeeApiKey "
0 commit comments