@@ -1369,6 +1369,54 @@ - (void)testHandleUniversalLinkCompletionReturnsNoForNonDDL {
1369
1369
}];
1370
1370
}
1371
1371
1372
+ - (void )testHandleUniversalLinkCompletionReturnsYesForValidDDL {
1373
+ [self .service setUpWithLaunchOptions: nil
1374
+ apiKey: kAPIKey
1375
+ urlScheme: kURLScheme
1376
+ userDefaults: self .userDefaults];
1377
+
1378
+ NSArray <NSString *> *urlStrings = @[
1379
+ @" https://some.page.link/test" , @" https://some.page.link/test-test" ,
1380
+ @" https://some.page.link/test_test" , @" https://some.page.link/test_test-test" ,
1381
+ @" https://some.app.goo.gl/test_test-test"
1382
+ ];
1383
+
1384
+ for (NSString *urlString in urlStrings) {
1385
+ NSURL *url = [NSURL URLWithString: urlString];
1386
+
1387
+ void (^executeRequestBlock)(id , NSDictionary *, NSString *,
1388
+ FIRNetworkRequestCompletionHandler) =
1389
+ ^(id p1, NSDictionary *requestBody, NSString *requestURLString,
1390
+ FIRNetworkRequestCompletionHandler handler) {
1391
+ NSData *data = FIRDataWithDictionary (@{}, nil );
1392
+ NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc ] initWithURL: url
1393
+ statusCode: 200
1394
+ HTTPVersion: nil
1395
+ headerFields: nil ];
1396
+ handler (data, response, nil );
1397
+ };
1398
+
1399
+ SEL executeRequestSelector = @selector (executeOnePlatformRequest:forURL:completionHandler: );
1400
+ [GULSwizzler swizzleClass: [FIRDynamicLinkNetworking class ]
1401
+ selector: executeRequestSelector
1402
+ isClassSelector: NO
1403
+ withBlock: executeRequestBlock];
1404
+
1405
+ XCTestExpectation *expectation = [self expectationWithDescription: @" handler called" ];
1406
+
1407
+ BOOL handled = [self .service
1408
+ handleUniversalLink: url
1409
+ completion: ^(FIRDynamicLink *_Nullable dynamicLink, NSError *_Nullable error) {
1410
+ XCTAssertNotNil (dynamicLink, @" Non DDL returned FIRDynamicLink" );
1411
+ [expectation fulfill ];
1412
+ }];
1413
+
1414
+ XCTAssertTrue (handled, @" Valid DDL Universal Link was not handled" );
1415
+
1416
+ [self waitForExpectationsWithTimeout: kAsyncTestTimout handler: nil ];
1417
+ }
1418
+ }
1419
+
1372
1420
- (void )test_ensureInternalMethodsNotRenamed {
1373
1421
// sanity check to ensure these methods has not been renamed
1374
1422
// we relaying on these to be the same for tests to work properly
0 commit comments