-
-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#832 Add tests for request & popsicle
- Loading branch information
1 parent
0a675c2
commit c9d011f
Showing
6 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
{ | ||
"name": "posicle-latest", | ||
"version": "0.0.0", | ||
"description": "Tests for popsicle latest (>9)", | ||
"main": "test.tap.js", | ||
"scripts": { | ||
"test": "tap test.tap.js" | ||
}, | ||
"dependencies": { | ||
"popsicle": "^9" | ||
}, | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const tap = require('tap'); | ||
const popsicle = require('popsicle'); | ||
const common = require('../common'); | ||
|
||
const makeRequest = (options) => { | ||
return popsicle.request({ | ||
url: options.uri, | ||
method: options.method || 'GET' | ||
}) | ||
.then((res) => { | ||
res.statusCode = res.status; | ||
|
||
return res; | ||
}) | ||
}; | ||
|
||
common.runCommonTests(makeRequest, 'popsicle@latest'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
{ | ||
"name": "request-latest", | ||
"version": "0.0.0", | ||
"description": "Tests for request latest (>2)", | ||
"main": "test.tap.js", | ||
"scripts": { | ||
"test": "tap test.tap.js" | ||
}, | ||
"dependencies": { | ||
"request": "^2" | ||
}, | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const tap = require('tap'); | ||
const request = require('request'); | ||
const common = require('../common'); | ||
|
||
const makeRequest = (options) => { | ||
return new Promise((resolve, reject) => { | ||
request({ | ||
uri: options.uri, | ||
method: options.method || 'GET' | ||
}, (err, res, body) => { | ||
if (err) { return reject(err); } | ||
|
||
res.body = body; | ||
resolve(res); | ||
}); | ||
}); | ||
}; | ||
|
||
common.runCommonTests(makeRequest, 'request@latest'); |