فهرست منبع

Fix typos and bugs etc

sbkwgh 8 سال پیش
والد
کامیت
33215f8770
1فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 9 7
      test/thread_post.js

+ 9 - 7
test/thread_post.js

@@ -58,13 +58,15 @@ describe('Thread and post', () => {
 				.post('/api/v1/thread')
 				.set('content-type', 'application/json')
 				.send({
-					name: 'thread'
+					name: 'thread',
+					category: 'category_name'
 				})
 
-			res.should.be.status(200)
-			res.body.should.be.json
+			res.should.have.status(200)
+			res.should.be.json
 			res.body.should.have.property('name', 'thread')
-
+			res.body.should.have.deep.property('User.username', 'username')
+			res.body.should.have.deep.property('Category.name', 'category_name')
 		})
 		it('should return an error if not logged in', async () => {
 			try {
@@ -86,7 +88,7 @@ describe('Thread and post', () => {
 		})
 		it('should return an error if missing parameters', async () => {
 			try {
-				let res = await agent
+				let res = await userAgent
 					.post('/api/v1/thread')
 
 				res.should.be.json
@@ -102,7 +104,7 @@ describe('Thread and post', () => {
 		})
 		it('should return an error if invalid types', async () => {
 			try {
-				let res = await agent
+				let res = await userAgent
 					.post('/api/v1/thread')
 					.set('content-type', 'application/json')
 					.send({
@@ -123,7 +125,7 @@ describe('Thread and post', () => {
 		})
 		it('should return an error if category does not exist', async () => {
 			try {
-				let res = await agent
+				let res = await userAgent
 					.post('/api/v1/thread')
 					.set('content-type', 'application/json')
 					.send({