test: use fetch.Promise consistently
On Node.js v4, Babel polyfills `Promise`.
This commit is contained in:
parent
a345c398b3
commit
e284841db9
|
@ -55,13 +55,13 @@ describe('node-fetch', () => {
|
||||||
it('should return a promise', function() {
|
it('should return a promise', function() {
|
||||||
url = 'http://example.com/';
|
url = 'http://example.com/';
|
||||||
const p = fetch(url);
|
const p = fetch(url);
|
||||||
expect(p).to.be.an.instanceof(Promise);
|
expect(p).to.be.an.instanceof(fetch.Promise);
|
||||||
expect(p).to.have.property('then');
|
expect(p).to.have.property('then');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow custom promise', function() {
|
it('should allow custom promise', function() {
|
||||||
url = 'http://example.com/';
|
url = 'http://example.com/';
|
||||||
const old = Promise;
|
const old = fetch.Promise;
|
||||||
fetch.Promise = then;
|
fetch.Promise = then;
|
||||||
expect(fetch(url)).to.be.an.instanceof(then);
|
expect(fetch(url)).to.be.an.instanceof(then);
|
||||||
expect(fetch(url)).to.not.be.an.instanceof(old);
|
expect(fetch(url)).to.not.be.an.instanceof(old);
|
||||||
|
|
Loading…
Reference in New Issue