do not make request to example.com, use local server instead, avoid UnhandledPromiseRejectionWarning altogether

This commit is contained in:
David Frank 2017-07-22 21:04:59 +08:00
parent a89bd94545
commit 70cd403914
2 changed files with 4 additions and 4 deletions

View File

@ -56,5 +56,5 @@
"url-search-params": "^0.9.0",
"whatwg-url": "^4.0.0"
},
"dependencies": { }
"dependencies": {}
}

View File

@ -58,14 +58,14 @@ after(done => {
describe('node-fetch', () => {
it('should return a promise', function() {
url = 'http://example.com/';
url = `${base}hello`;
const p = fetch(url);
expect(p).to.be.an.instanceof(fetch.Promise);
expect(p).to.have.property('then');
});
it('should allow custom promise', function() {
url = 'http://example.com/';
url = `${base}hello`;
const old = fetch.Promise;
fetch.Promise = then;
expect(fetch(url)).to.be.an.instanceof(then);
@ -74,7 +74,7 @@ describe('node-fetch', () => {
});
it('should throw error when no promise implementation are found', function() {
url = 'http://example.com/';
url = `${base}hello`;
const old = fetch.Promise;
fetch.Promise = undefined;
expect(() => {