Skip to content

Commit

Permalink
Added test for posting JSON arrays to create
Browse files Browse the repository at this point in the history
Added testing for JSON arrays
  • Loading branch information
Hanif Bali authored and Hanif Bali committed Oct 3, 2015
1 parent 0101b0e commit eb62c9b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/integration/router.APIScaffold.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ describe('router :: ', function() {
});
});

describe('a post of JSON array request to /:controller/create', function() {
it('should return JSON array for a newly created instances of the test model', function (done) {
httpHelper.testRoute('post', {
url: 'empty/create',
json: true,
body: [{stuff: "bad"}, {stuff: "ghuud"}]
}, function (err, response) {
if (err) return done(new Error(err));

assert(response.body instanceof Array && response.body[1].stuff === "ghuud", Err.badResponse(response));
done();
});
});
});

describe('with pluralize turned on', function() {

before(function() {
Expand Down Expand Up @@ -323,6 +338,7 @@ describe('router :: ', function() {

});


describe('`prefix` and `restPrefix` config options set together :: ', function() {

before(function() {
Expand Down Expand Up @@ -358,6 +374,7 @@ describe('router :: ', function() {

});


});

describe('API scaffold routes', function() {
Expand Down

0 comments on commit eb62c9b

Please sign in to comment.