+ const deletedChildOfFirstChild = tree.children[1]
+ expect(deletedChildOfFirstChild.comment.text).to.equal('')
+ expect(deletedChildOfFirstChild.comment.isDeleted).to.be.true
+ expect(deletedChildOfFirstChild.comment.deletedAt).to.not.be.null
+ expect(deletedChildOfFirstChild.comment.account).to.be.null
+ expect(deletedChildOfFirstChild.children).to.have.lengthOf(0)
+ }
+ })
+
+ it('Should delete a complete thread', async function () {
+ await command.delete({ videoId, commentId: threadId })
+
+ const body = await command.listThreads({ videoId: videoUUID, sort: 'createdAt' })
+ expect(body.total).to.equal(3)
+ expect(body.data).to.be.an('array')
+ expect(body.data).to.have.lengthOf(3)
+
+ expect(body.data[0].text).to.equal('')
+ expect(body.data[0].isDeleted).to.be.true
+ expect(body.data[0].deletedAt).to.not.be.null
+ expect(body.data[0].account).to.be.null
+ expect(body.data[0].totalReplies).to.equal(2)
+ expect(body.data[1].text).to.equal('super thread 2')
+ expect(body.data[1].totalReplies).to.equal(0)
+ expect(body.data[2].text).to.equal('super thread 3')
+ expect(body.data[2].totalReplies).to.equal(0)
+ })
+
+ it('Should count replies from the video author correctly', async function () {
+ await command.createThread({ videoId: videoUUID, text: 'my super first comment' })
+
+ const { data } = await command.listThreads({ videoId: videoUUID })
+ const threadId2 = data[0].threadId
+
+ const text2 = 'a first answer to thread 4 by a third party'
+ await command.addReply({ token: userAccessTokenServer1, videoId, toCommentId: threadId2, text: text2 })
+
+ const text3 = 'my second answer to thread 4'
+ await command.addReply({ videoId, toCommentId: threadId2, text: text3 })
+
+ const tree = await command.getThread({ videoId: videoUUID, threadId: threadId2 })
+ expect(tree.comment.totalReplies).to.equal(tree.comment.totalRepliesFromVideoAuthor + 1)
+ })