Electron-385 (Remove third party dependency and write custom implementation) (#350)

- Remove third party dependency and write custom implementation
- Add negative test case
This commit is contained in:
Kiran Niranjan
2018-05-01 15:21:00 +05:30
committed by Vishwas Shashidhar
parent c1e4016e93
commit 59a80f558c
3 changed files with 43 additions and 2 deletions

View File

@@ -32,6 +32,13 @@ describe('validate url with whitelist', function() {
return expect(checkWhitelist(url, whitelist)).toBeTruthy();
});
it('should return true for non-standard TLDs', function() {
const whitelist = 'symphony.com, symphony.econet';
const url = 'https://my.symphony.econet/';
return expect(checkWhitelist(url, whitelist)).toBeTruthy();
});
});
describe('checkWhitelist falsity tests', function () {
@@ -50,6 +57,13 @@ describe('validate url with whitelist', function() {
return expect(checkWhitelist(url, whitelist)).toBeFalsy();
});
it('should return false when TLD does not match', function () {
const whitelist = 'www.symphony.com, app.symphony.com, my.symphony.com';
const url = 'https://my.symphony.echonet/';
return expect(checkWhitelist(url, whitelist)).toBeFalsy();
});
it('should return false when the URL is invalid', function () {
const whitelist = 'www.symphony.com, app.symphony.com, my.symphony.com';
const url = 'invalidUrl';