viki-web-utils
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -18,2 +18,6 @@ 'use strict'; | ||
} | ||
if (!(fetch && Request)) { | ||
throw new Error('BlockedResourceChecker: fetch and Request not supported on this browser'); | ||
} | ||
} | ||
@@ -33,3 +37,4 @@ /** | ||
}); | ||
return fetch(request).then(function (resolve, reject) { | ||
return fetch(request).then(function () { | ||
return Promise.resolve({ | ||
@@ -36,0 +41,0 @@ blocked: false, |
{ | ||
"name": "viki-web-utils", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Utils used by the Viki web app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,2 +13,18 @@ /* eslint-env jasmine */ | ||
it('should throw an if fetch not supported', () => { | ||
const fetch = window.fetch; | ||
window.fetch = undefined; | ||
expect(function () {new BlockedResourceChecker('http://viki.com');}) | ||
.toThrow(new Error('BlockedResourceChecker: fetch and Request not supported on this browser')); | ||
window.fetch = fetch; | ||
}); | ||
it('should throw an if Request not supported', () => { | ||
const Request = window.Request; | ||
window.Request = undefined; | ||
expect(function () {new BlockedResourceChecker('http://viki.com');}) | ||
.toThrow(new Error('BlockedResourceChecker: fetch and Request not supported on this browser')); | ||
window.Request = Request; | ||
}); | ||
it('should throw an error when passed an invalid resource', () => { | ||
@@ -68,3 +84,3 @@ const expectedError = new Error('BlockedResourceChecker: Please pass in valid URI for resource param'); | ||
it('promise returned should resolve with blocked: false if resource is available', (done) => { | ||
const url = 'https://secure.quantserve.com/quant.js' | ||
const url = 'https://secure.quantserve.com/quant.js'; | ||
this.checker = new BlockedResourceChecker(url); | ||
@@ -71,0 +87,0 @@ const promise = this.checker.test(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1188623
2504
13