diff --git a/tests/src/tests/links/linksTests.js b/tests/src/tests/links/linksTests.js index 3f6e9017..9b37c16e 100644 --- a/tests/src/tests/links/linksTests.js +++ b/tests/src/tests/links/linksTests.js @@ -73,7 +73,7 @@ function linksTests({ describe, it, firebase, tryCatch }) { Object.keys(expectedParameters).forEach((key) => { const val = expectedParameters[key]; - val.should.eql(params[key]); + params[key].should.eql(val); }); }); @@ -87,12 +87,11 @@ function linksTests({ describe, it, firebase, tryCatch }) { const result = await links.createDynamicLink(data); - result.should.startWith(`https://${dynamicLinkDomain}`); - - const encodedLink = encodeURIComponent(link); - const encodedLinkWithEncodedPeriod = encodeURIComponent(link).replace(/\./g, '%2E'); - (result.includes(`link=${encodedLink}`) || - result.includes(`link=${encodedLinkWithEncodedPeriod}`)).should.be.true(); + const url = new URL(result); + url.protocol.should.eql('https:'); + url.hostname.should.eql(dynamicLinkDomain); + const params = queryString.parse(url.query); + params.link.should.eql(link); }); it('fail to create long dynamic link with empty data object', () => {