@@ -528,7 +528,7 @@ - (void)testFDLComponentsNotNilOnDomainWithHTTPScheme {
528528 NSURL *link = [NSURL URLWithString: linkString];
529529
530530 FIRDynamicLinkComponents *components =
531- [FIRDynamicLinkComponents componentsWithLink: link domain :@" http ://xyz.page.link" ];
531+ [FIRDynamicLinkComponents componentsWithLink: link domainURIPrefix :@" https ://xyz.page.link" ];
532532
533533 XCTAssertNotNil (components);
534534}
@@ -538,7 +538,7 @@ - (void)testFDLComponentsNotNilOnDomainWithHTTPSScheme {
538538 NSURL *link = [NSURL URLWithString: linkString];
539539
540540 FIRDynamicLinkComponents *components =
541- [FIRDynamicLinkComponents componentsWithLink: link domain :@" https://xyz.page.link" ];
541+ [FIRDynamicLinkComponents componentsWithLink: link domainURIPrefix :@" https://xyz.page.link" ];
542542
543543 XCTAssertNotNil (components);
544544}
@@ -549,10 +549,9 @@ - (void)testFDLComponentsFailsOnMalformedDomain {
549549
550550 FIRDynamicLinkComponents *components =
551551 [FIRDynamicLinkComponents componentsWithLink: link
552- domain :@" this is invalid domain URI Prefix" ];
552+ domainURIPrefix :@" this is invalid domain URI Prefix" ];
553553
554- XCTAssertNotNil (components);
555- XCTAssertNil (components.url );
554+ XCTAssertNil (components);
556555}
557556
558557- (void )testFDLComponentsCreatesFullLinkCorrectly {
@@ -708,79 +707,6 @@ - (void)testShortenURL {
708707 [componentsClassMock stopMocking ];
709708}
710709
711- - (void )testDeprecatedMethodComponentsWithLinkForDomain {
712- NSString *shortURLString = @" https://xyz.page.link/abcd" ;
713-
714- // Mock key provider
715- id keyProviderClassMock = OCMClassMock ([FIRDynamicLinkComponentsKeyProvider class ]);
716- [[[keyProviderClassMock expect ] andReturn: @" fake-api-key" ] APIKey ];
717-
718- id componentsClassMock = OCMClassMock ([FIRDynamicLinkComponents class ]);
719- [[componentsClassMock expect ]
720- sendHTTPRequest: OCMOCK_ANY
721- completion: [OCMArg checkWithBlock: ^BOOL (id obj) {
722- void (^completion)(NSData *_Nullable, NSError *_Nullable) = obj;
723- NSDictionary *JSON = @{@" shortLink" : shortURLString};
724- NSData *JSONData = [NSJSONSerialization dataWithJSONObject: JSON options: 0 error: 0 ];
725- completion (JSONData, nil );
726- return YES ;
727- }]];
728-
729- XCTestExpectation *expectation = [self expectationWithDescription: @" completion called" ];
730- NSURL *link = [NSURL URLWithString: @" https://google.com/abc" ];
731- FIRDynamicLinkComponents *components =
732- [FIRDynamicLinkComponents componentsWithLink: link domain: @" xyz.page.link" ];
733- [components
734- shortenWithCompletion: ^(NSURL *_Nullable shortURL, NSArray <NSString *> *_Nullable warnings,
735- NSError *_Nullable error) {
736- XCTAssertEqualObjects (shortURL.absoluteString , shortURLString);
737- [expectation fulfill ];
738- }];
739- [self waitForExpectationsWithTimeout: 0.1 handler: nil ];
740-
741- [keyProviderClassMock verify ];
742- [keyProviderClassMock stopMocking ];
743- [componentsClassMock verify ];
744- [componentsClassMock stopMocking ];
745- }
746-
747- - (void )testDeprecatedMethodComponentsWithLinkForDomainWithInvalidDomainScheme {
748- NSString *shortURLString = @" https://xyz.page.link/abcd" ;
749-
750- // Mock key provider
751- id keyProviderClassMock = OCMClassMock ([FIRDynamicLinkComponentsKeyProvider class ]);
752- [[[keyProviderClassMock expect ] andReturn: @" fake-api-key" ] APIKey ];
753-
754- id componentsClassMock = OCMClassMock ([FIRDynamicLinkComponents class ]);
755- [[componentsClassMock expect ]
756- sendHTTPRequest: OCMOCK_ANY
757- completion: [OCMArg checkWithBlock: ^BOOL (id obj) {
758- void (^completion)(NSData *_Nullable, NSError *_Nullable) = obj;
759- NSDictionary *JSON = @{@" shortLink" : shortURLString};
760- NSData *JSONData = [NSJSONSerialization dataWithJSONObject: JSON options: 0 error: 0 ];
761- completion (JSONData, nil );
762- return YES ;
763- }]];
764-
765- XCTestExpectation *expectation = [self expectationWithDescription: @" completion called" ];
766- NSURL *link = [NSURL URLWithString: @" https://google.com/abc" ];
767- FIRDynamicLinkComponents *components =
768- [FIRDynamicLinkComponents componentsWithLink: link domain: @" http://xyz.page.link" ];
769- XCTAssertNotNil (components);
770- [components
771- shortenWithCompletion: ^(NSURL *_Nullable shortURL, NSArray <NSString *> *_Nullable warnings,
772- NSError *_Nullable error) {
773- XCTAssertEqualObjects (shortURL.absoluteString , shortURLString);
774- [expectation fulfill ];
775- }];
776- [self waitForExpectationsWithTimeout: 0.1 handler: nil ];
777-
778- [keyProviderClassMock verify ];
779- [keyProviderClassMock stopMocking ];
780- [componentsClassMock verify ];
781- [componentsClassMock stopMocking ];
782- }
783-
784710- (void )testShortenURLReturnsErrorWhenAPIKeyMissing {
785711 NSString *shortURLString = @" https://xyz.page.link/abcd" ;
786712
0 commit comments