Skip to content

Commit

Permalink
Add tests for bodies containing null and 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sgress454 committed Mar 21, 2017
1 parent f40e263 commit 93a2d0a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ var EXPECTED_RESPONSES = {
'get /someJSON': {
body: { foo: 'bar' }
},
'get /someNull': {
body: null
},
'get /someZero': {
body: 0
},
'get /someError': {
body: { blah: 'blah' },
statusCode: 501
Expand Down Expand Up @@ -116,6 +122,27 @@ describe('io.socket', function () {
});
});

it('should be able to receive a `null` body', function (cb) {
io.socket.get('/someNull', function (body, jwr) {
assertResponse('get /someNull', arguments);
return cb();
});
});

it('should be able to receive a body containing the number zero', function (cb) {
io.socket.get('/someZero', function (body, jwr) {
assertResponse('get /someZero', arguments);
return cb();
});
});

it('should receive JSON as a POJO, not a string', function (cb) {
io.socket.get('/someJSON', function (body, jwr) {
assertResponse('get /someJSON', arguments);
return cb();
});
});

it('should receive a valid jwr response object as its second argument, with the correct error code', function (cb) {
io.socket.get('/someError', function (body, jwr) {
assertResponse('get /someError', arguments);
Expand Down

0 comments on commit 93a2d0a

Please sign in to comment.