[go: nahoru, domu]

Skip to content

Commit

Permalink
Fdl unit tests (#9511)
Browse files Browse the repository at this point in the history
 Adding unit tests to further check custom domain validations.
  • Loading branch information
eldhosembabu committed Mar 23, 2022
1 parent 6911d52 commit 6efe4f5
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,18 @@ - (void)testValidCustomDomainNames {
NSArray<NSString *> *longFDLURLStrings = @[
@"https://a.firebase.com/mypath/?link=https://abcd&test=1", // Long FDL starting with
// https://a.firebase.com/mypath
@"https://google.com?link=http://abcd", // Long FDL starting with 'https://google.com'
@"https://google.com/?link=http://abcd", // Long FDL starting with 'https://google.com'
@"https://google.com?link=https://somedomain&some=qry", // Long FDL with link param as another
// argument.
@"https://google.com/?link=https://somedomain&some=qry", // Long FDL with link param as another
// argument.
@"https://google.com?some=qry&link=https://somedomain", // Long FDL with link param as second
// argument.
@"https://google.com/?some=qry&link=https://somedomain", // Long FDL with link param as second
// argument
@"https://google.com/?a=b&c=d&link=https://somedomain&y=z", // Long FDL with link param as
// middle argument argument
];
for (NSString *urlString in urlStrings) {
NSURL *url = [NSURL URLWithString:urlString];
Expand All @@ -1638,15 +1649,17 @@ - (void)testInvalidCustomDomainNames {
// https://a.firebase.com/mypath

NSArray<NSString *> *urlStrings = @[
@"google.com", // Valid domain. No scheme.
@"https://google.com", // Valid domain. No path after domainURIPrefix.
@"https://google.com/", // Valid domain. No path after domainURIPrefix.
@"https://google.co.in/mylink", // No matching domainURIPrefix.
@"https://firebase.com/mypath", // No matching domainURIPrefix: Invalid (sub)domain.
@"https://b.firebase.com/mypath", // No matching domainURIPrefix: Invalid subdomain.
@"https://a.firebase.com/mypathabc", // No matching domainURIPrefix: Invalid subdomain.
@"mydomain.com", // https scheme not specified for domainURIPrefix.
@"http://mydomain", // Domain not in plist. No path after domainURIPrefix.
@"google.com", // Valid domain. No scheme.
@"https://google.com", // Valid domain. No path after domainURIPrefix.
@"https://google.com/", // Valid domain. No path after domainURIPrefix.
@"https://google.co.in/mylink", // No matching domainURIPrefix.
@"https://google.com/?some=qry", // Valid domain with no path and link param
@"https://google.com/?some=qry&link=bla", // Valid domain with no path and no valid link param
@"https://firebase.com/mypath", // No matching domainURIPrefix: Invalid (sub)domain.
@"https://b.firebase.com/mypath", // No matching domainURIPrefix: Invalid subdomain.
@"https://a.firebase.com/mypathabc", // No matching domainURIPrefix: Invalid subdomain.
@"mydomain.com", // https scheme not specified for domainURIPrefix.
@"http://mydomain", // Domain not in plist. No path after domainURIPrefix.
@"https://somecustom.com?", @"https://somecustom.com/?",
@"https://somecustom.com?somekey=someval"
];
Expand Down

0 comments on commit 6efe4f5

Please sign in to comment.