Skip to content

Commit 721a9aa

Browse files
authored
Merge pull request node-fetch#315 from bitinn/fix-test
Fix test cases for node-fetch#314, node-fetch#292
2 parents a89bd94 + 9bd099a commit 721a9aa

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@
5656
"url-search-params": "^0.9.0",
5757
"whatwg-url": "^4.0.0"
5858
},
59-
"dependencies": { }
59+
"dependencies": {}
6060
}

test/test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ after(done => {
5858

5959
describe('node-fetch', () => {
6060
it('should return a promise', function() {
61-
url = 'http://example.com/';
61+
url = `${base}hello`;
6262
const p = fetch(url);
6363
expect(p).to.be.an.instanceof(fetch.Promise);
6464
expect(p).to.have.property('then');
6565
});
6666

6767
it('should allow custom promise', function() {
68-
url = 'http://example.com/';
68+
url = `${base}hello`;
6969
const old = fetch.Promise;
7070
fetch.Promise = then;
7171
expect(fetch(url)).to.be.an.instanceof(then);
@@ -74,7 +74,7 @@ describe('node-fetch', () => {
7474
});
7575

7676
it('should throw error when no promise implementation are found', function() {
77-
url = 'http://example.com/';
77+
url = `${base}hello`;
7878
const old = fetch.Promise;
7979
fetch.Promise = undefined;
8080
expect(() => {
@@ -626,24 +626,24 @@ describe('node-fetch', () => {
626626
});
627627

628628
it('should clear internal timeout on fetch response', function (done) {
629-
this.timeout(1000);
630-
spawn('node', ['-e', `require('./')('${base}hello', { timeout: 5000 })`])
629+
this.timeout(2000);
630+
spawn('node', ['-e', `require('./')('${base}hello', { timeout: 10000 })`])
631631
.on('exit', () => {
632632
done();
633633
});
634634
});
635635

636636
it('should clear internal timeout on fetch redirect', function (done) {
637-
this.timeout(1000);
638-
spawn('node', ['-e', `require('./')('${base}redirect/301', { timeout: 5000 })`])
637+
this.timeout(2000);
638+
spawn('node', ['-e', `require('./')('${base}redirect/301', { timeout: 10000 })`])
639639
.on('exit', () => {
640640
done();
641641
});
642642
});
643643

644644
it('should clear internal timeout on fetch error', function (done) {
645-
this.timeout(1000);
646-
spawn('node', ['-e', `require('./')('${base}error/reset', { timeout: 5000 })`])
645+
this.timeout(2000);
646+
spawn('node', ['-e', `require('./')('${base}error/reset', { timeout: 10000 })`])
647647
.on('exit', () => {
648648
done();
649649
});

0 commit comments

Comments
 (0)