Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add status code description to errors

  • Loading branch information...
commit ae04e5951c9b62e25aeffc64483450ddd173d872 1 parent 5bf6c94
@tj tj authored
Showing with 5 additions and 2 deletions.
  1. +4 −1 lib/test.js
  2. +1 −1  test/supertest.js
View
5 lib/test.js
@@ -6,6 +6,7 @@
var request = require('superagent')
, util = require('util')
+ , http = require('http')
, Request = request.Request;
/**
@@ -113,7 +114,9 @@ Test.prototype.assert = function(res, fn){
// status
if (status && res.status !== status) {
- return fn(new Error('expected ' + status + ' response, got ' + res.status), res);
+ var a = http.STATUS_CODES[status];
+ var b = http.STATUS_CODES[res.status];
+ return fn(new Error('expected ' + status + ' "' + a + '", got ' + res.status + ' "' + b + '"'), res);
}
// body
View
2  test/supertest.js
@@ -49,7 +49,7 @@ describe('request(app)', function(){
.get('/')
.expect(404)
.end(function(err, res){
- err.message.should.equal('expected 404 response, got 200');
+ err.message.should.equal('expected 404 "Not Found", got 200 "OK"');
done();
});
})
Please sign in to comment.
Something went wrong with that request. Please try again.