Permalink
Browse files

added res.json() array test to illustrate that it works

  • Loading branch information...
tj committed Mar 24, 2012
1 parent d396761 commit fdf96922b51f0ee60db0b05b0380cc04f4cfa74c
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/res.json.js
View
@@ -22,6 +22,24 @@ describe('res', function(){
})
})
})
+
+ describe('when given an array', function(){
+ it('should respond with json', function(done){
+ var app = express();
+
+ app.use(function(req, res){
+ res.json(['foo', 'bar', 'baz']);
+ });
+
+ request(app)
+ .get('/')
+ .end(function(res){
+ res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
+ res.body.should.equal('["foo","bar","baz"]');
+ done();
+ })
+ })
+ })
describe('when given an object', function(){
it('should respond with json', function(done){

0 comments on commit fdf9692

Please sign in to comment.