Browse Source

Fix incorrect promise implementation - n.b. chai gives an error even though test is passing because the resource (correctly) returns a 403 forbidden error (perhaps a bug in chaijs)

sbkwgh 8 năm trước cách đây
mục cha
commit
ba889de32d
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      test/user.js

+ 6 - 4
test/user.js

@@ -183,16 +183,17 @@ describe('User', () => {
 
 					agent
 						.get('/api/v1/user/username')
-						.then((err, res) => {
+						.then((res) => {
 							res.should.have.status(200)
 
 							done()
 						})
+						.catch(done)
 				})
 		})
 	})
 
-	describe('/logout POST user', () => {
+	describe('/:username/logout POST user', () => {
 		let agent = chai.request.agent(server)
 
 		it('should log out the user', (done) => {
@@ -206,18 +207,19 @@ describe('User', () => {
 				.end((err, res) => {
 
 					agent
-						.post('/api/v1/user/logout')
+						.post('/api/v1/user/username/logout')
 						.end((err, res) => {
 							res.should.have.status(200)
 
 							agent
 								.get('/api/v1/user/username')
-								.then((err, res) => {
+								.then((res) => {
 									res.should.have.status(403)
 									res.body.errors.should.contain.something.that.deep.equals(Errors.requestNotAuthorized)
 
 									done()
 								})
+								.catch(done)
 						})
 				})
 		})