Skip to content

Commit 6efe4f5

Browse files
authored
Fdl unit tests (#9511)
Adding unit tests to further check custom domain validations.
1 parent 6911d52 commit 6efe4f5

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,18 @@ - (void)testValidCustomDomainNames {
16151615
NSArray<NSString *> *longFDLURLStrings = @[
16161616
@"https://a.firebase.com/mypath/?link=https://abcd&test=1", // Long FDL starting with
16171617
// https://a.firebase.com/mypath
1618+
@"https://google.com?link=http://abcd", // Long FDL starting with 'https://google.com'
16181619
@"https://google.com/?link=http://abcd", // Long FDL starting with 'https://google.com'
1620+
@"https://google.com?link=https://somedomain&some=qry", // Long FDL with link param as another
1621+
// argument.
1622+
@"https://google.com/?link=https://somedomain&some=qry", // Long FDL with link param as another
1623+
// argument.
1624+
@"https://google.com?some=qry&link=https://somedomain", // Long FDL with link param as second
1625+
// argument.
1626+
@"https://google.com/?some=qry&link=https://somedomain", // Long FDL with link param as second
1627+
// argument
1628+
@"https://google.com/?a=b&c=d&link=https://somedomain&y=z", // Long FDL with link param as
1629+
// middle argument argument
16191630
];
16201631
for (NSString *urlString in urlStrings) {
16211632
NSURL *url = [NSURL URLWithString:urlString];
@@ -1638,15 +1649,17 @@ - (void)testInvalidCustomDomainNames {
16381649
// https://a.firebase.com/mypath
16391650

16401651
NSArray<NSString *> *urlStrings = @[
1641-
@"google.com", // Valid domain. No scheme.
1642-
@"https://google.com", // Valid domain. No path after domainURIPrefix.
1643-
@"https://google.com/", // Valid domain. No path after domainURIPrefix.
1644-
@"https://google.co.in/mylink", // No matching domainURIPrefix.
1645-
@"https://firebase.com/mypath", // No matching domainURIPrefix: Invalid (sub)domain.
1646-
@"https://b.firebase.com/mypath", // No matching domainURIPrefix: Invalid subdomain.
1647-
@"https://a.firebase.com/mypathabc", // No matching domainURIPrefix: Invalid subdomain.
1648-
@"mydomain.com", // https scheme not specified for domainURIPrefix.
1649-
@"http://mydomain", // Domain not in plist. No path after domainURIPrefix.
1652+
@"google.com", // Valid domain. No scheme.
1653+
@"https://google.com", // Valid domain. No path after domainURIPrefix.
1654+
@"https://google.com/", // Valid domain. No path after domainURIPrefix.
1655+
@"https://google.co.in/mylink", // No matching domainURIPrefix.
1656+
@"https://google.com/?some=qry", // Valid domain with no path and link param
1657+
@"https://google.com/?some=qry&link=bla", // Valid domain with no path and no valid link param
1658+
@"https://firebase.com/mypath", // No matching domainURIPrefix: Invalid (sub)domain.
1659+
@"https://b.firebase.com/mypath", // No matching domainURIPrefix: Invalid subdomain.
1660+
@"https://a.firebase.com/mypathabc", // No matching domainURIPrefix: Invalid subdomain.
1661+
@"mydomain.com", // https scheme not specified for domainURIPrefix.
1662+
@"http://mydomain", // Domain not in plist. No path after domainURIPrefix.
16501663
@"https://somecustom.com?", @"https://somecustom.com/?",
16511664
@"https://somecustom.com?somekey=someval"
16521665
];

0 commit comments

Comments
 (0)