Permalink
Browse files

improved a test

  • Loading branch information...
1 parent 219f331 commit 42a9f9aa75847dade6c310b24b9898c7b8893a10 @tj tj committed Nov 22, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 test/bodyParser.js
View
@@ -143,10 +143,14 @@ describe('connect.bodyParser()', function(){
.post('/')
.set('Content-Type', 'multipart/form-data; boundary=foo')
.write('--foo\r\n')
- .write('Content-Disposition: form-data; name="user[name]"\r\n')
+ .write('Content-Disposition: form-data; name="user[name][first]"\r\n')
.write('\r\n')
.write('tobi')
.write('\r\n--foo\r\n')
+ .write('Content-Disposition: form-data; name="user[name][last]"\r\n')
+ .write('\r\n')
+ .write('holowaychuk')
+ .write('\r\n--foo\r\n')
.write('Content-Disposition: form-data; name="user[age]"\r\n')
.write('\r\n')
.write('1')
@@ -156,7 +160,10 @@ describe('connect.bodyParser()', function(){
.write('ferret')
.write('\r\n--foo--')
.end(function(res){
- res.body.should.equal('{"user":{"name":"tobi","age":"1"},"species":"ferret"}');
+ var obj = JSON.parse(res.body);
+ obj.user.age.should.equal('1');
+ obj.user.name.should.eql({ first: 'tobi', last: 'holowaychuk' });
+ obj.species.should.equal('ferret');
done();
});
})

0 comments on commit 42a9f9a

Please sign in to comment.