change tests to use url-parse

This commit is contained in:
erezrokah 2017-10-08 18:05:48 +03:00
parent 64ba939361
commit 98ade4d161
1 changed files with 6 additions and 7 deletions

View File

@ -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', () => {