Skip to content

Commit

Permalink
Merge 8119278 into 0cfc198
Browse files Browse the repository at this point in the history
  • Loading branch information
rimiti committed Mar 14, 2019
2 parents 0cfc198 + 8119278 commit 951824f
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 55 deletions.
134 changes: 81 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"methods": "^1.1.2",
"superagent": "^4.1.0"
"superagent": "^3.8.3"
},
"devDependencies": {
"body-parser": "^1.18.3",
Expand Down
19 changes: 18 additions & 1 deletion test/supertest.js
Expand Up @@ -8,6 +8,8 @@ const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const nock = require('nock');

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

describe('request(url)', function () {
it('should be supported', function (done) {
const app = express();
Expand Down Expand Up @@ -114,7 +116,6 @@ describe('request(app)', function () {

request(server)
.get('/')
.trustLocalhost()
.end(function (err, res) {
if (err) return done(err);
res.status.should.equal(200);
Expand Down Expand Up @@ -1196,4 +1197,20 @@ describe('request.get(url).query(vals) works as expected', function () {

nock.restore();
});

it('should assert using promises', function (done) {
const app = express();

app.get('/', function (req, res) {
res.status(400).send({ promise: true });
});

request(app)
.get('/')
.expect(400)
.then((res) => {
res.body.promise.should.be.equal(true);
done();
});
});
});

0 comments on commit 951824f

Please sign in to comment.