瀏覽代碼

Chang test so that it actually tests body (not other incorrect field

sbkwgh 8 年之前
父節點
當前提交
bb037679d8
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      test/user.js

+ 7 - 4
test/user.js

@@ -12,13 +12,16 @@ describe('User', () => {
 		it('should create an account', (done) => {
 			chai.request(server)
 				.post('/api/v1/user')
-				.field('username', 'test')
-				.field('password', 'pass')
+				.set('content-type', 'application/x-www-form-urlencoded')
+				.send({
+					username: 'test',
+					password: 'pass'
+				})
 				.end((err, res) => {
 					res.should.have.status(200)
 					res.should.be.json
-					res.should.have.property('username', 'test')
-					res.should.have.property('hash')
+					res.body.should.have.property('username', 'test')
+					res.body.should.have.property('hash')
 					
 					done()
 				})