change tests to use url-parse
This commit is contained in:
parent
64ba939361
commit
98ade4d161
|
@ -73,7 +73,7 @@ function linksTests({ describe, it, firebase, tryCatch }) {
|
||||||
|
|
||||||
Object.keys(expectedParameters).forEach((key) => {
|
Object.keys(expectedParameters).forEach((key) => {
|
||||||
const val = expectedParameters[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);
|
const result = await links.createDynamicLink(data);
|
||||||
|
|
||||||
result.should.startWith(`https://${dynamicLinkDomain}`);
|
const url = new URL(result);
|
||||||
|
url.protocol.should.eql('https:');
|
||||||
const encodedLink = encodeURIComponent(link);
|
url.hostname.should.eql(dynamicLinkDomain);
|
||||||
const encodedLinkWithEncodedPeriod = encodeURIComponent(link).replace(/\./g, '%2E');
|
const params = queryString.parse(url.query);
|
||||||
(result.includes(`link=${encodedLink}`) ||
|
params.link.should.eql(link);
|
||||||
result.includes(`link=${encodedLinkWithEncodedPeriod}`)).should.be.true();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fail to create long dynamic link with empty data object', () => {
|
it('fail to create long dynamic link with empty data object', () => {
|
||||||
|
|
Loading…
Reference in New Issue