Browse Source

Add test for posts count on threads

sbkwgh 8 năm trước cách đây
mục cha
commit
ee9f447478
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      test/thread_post.js

+ 3 - 0
test/thread_post.js

@@ -69,6 +69,7 @@ describe('Thread and post', () => {
 			res.should.have.status(200)
 			res.should.be.json
 			res.body.should.have.property('name', 'thread')
+			res.body.should.have.property('postCount', 0)
 			res.body.should.have.property('slug', 'thread')
 			res.body.should.have.deep.property('User.username', 'username')
 			res.body.should.have.deep.property('Category.name', 'category_name')
@@ -179,6 +180,7 @@ describe('Thread and post', () => {
 			res.body.should.have.property('content', '<p>content</p>\n')
 			res.body.should.have.deep.property('User.username', 'username')
 			res.body.should.have.deep.property('Thread.name', 'thread')
+			res.body.should.have.deep.property('Thread.postCount', 1)
 
 		})
 		it('should return an error if not logged in', async () => {
@@ -281,6 +283,7 @@ describe('Thread and post', () => {
 			res.body.should.have.property('content', '<p>another post</p>\n')
 			res.body.should.have.deep.property('User.username', 'username1')
 			res.body.should.have.deep.property('Thread.name', 'thread')
+			res.body.should.have.deep.property('Thread.postCount', 2)
 			res.body.should.have.property('replyingToUsername', 'username')
 			res.body.should.have.property('Replies').that.deep.equals([])
 		})