+ it('Should send comments on a video to server 3, and automatically fetch the video', async function () {
+ this.timeout(25000)
+
+ await addVideoCommentReply(servers[0].url, servers[0].accessToken, missedVideo2.uuid, commentIdServer1, 'comment 1-3')
+
+ await waitJobs(servers)
+
+ const resVideo = await getVideo(servers[2].url, missedVideo2.uuid)
+ expect(resVideo.body).not.to.be.undefined
+
+ {
+ let resComment = await getVideoCommentThreads(servers[2].url, missedVideo2.uuid, 0, 5)
+ expect(resComment.body.data).to.be.an('array')
+ expect(resComment.body.data).to.have.lengthOf(1)
+
+ threadIdServer2 = resComment.body.data[0].id
+
+ resComment = await getVideoThreadComments(servers[2].url, missedVideo2.uuid, threadIdServer2)
+
+ const tree: VideoCommentThreadTree = resComment.body
+ expect(tree.comment.text).equal('thread 1')
+ expect(tree.children).to.have.lengthOf(1)
+
+ const firstChild = tree.children[0]
+ expect(firstChild.comment.text).to.equal('comment 1-1')
+ expect(firstChild.children).to.have.lengthOf(1)
+
+ const childOfFirstChild = firstChild.children[0]
+ expect(childOfFirstChild.comment.text).to.equal('comment 1-2')
+ expect(childOfFirstChild.children).to.have.lengthOf(1)
+
+ const childOfChildFirstChild = childOfFirstChild.children[0]
+ expect(childOfChildFirstChild.comment.text).to.equal('comment 1-3')
+ expect(childOfChildFirstChild.children).to.have.lengthOf(0)
+
+ commentIdServer2 = childOfChildFirstChild.comment.id
+ }
+ })
+
+ it('Should correctly reply to the comment', async function () {
+ this.timeout(15000)
+
+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, missedVideo2.uuid, commentIdServer2, 'comment 1-4')
+
+ await waitJobs(servers)
+
+ {
+ const resComment = await getVideoThreadComments(servers[0].url, missedVideo2.uuid, threadIdServer1)
+
+ const tree: VideoCommentThreadTree = resComment.body
+ expect(tree.comment.text).equal('thread 1')
+ expect(tree.children).to.have.lengthOf(1)