aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/multiple-servers.ts
diff options
context:
space:
mode:
authorJulien Maulny <julien.maulny@protonmail.com>2019-12-03 21:48:31 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-12-04 09:36:45 +0100
commitb5206dfc455c119b0dcb897bd7144be6ea4d999d (patch)
treed79387081b80c0bbee38beee00f6560a599a99a9 /server/tests/api/videos/multiple-servers.ts
parent69222afac8f8c41d90295b33f0695bbff352851e (diff)
downloadPeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.tar.gz
PeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.tar.zst
PeerTube-b5206dfc455c119b0dcb897bd7144be6ea4d999d.zip
Fix retrieving of deleted comments when subscribing to a new instance
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r--server/tests/api/videos/multiple-servers.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index e7b57ba1f..836bdc658 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -15,6 +15,7 @@ import {
15 createUser, 15 createUser,
16 dateIsValid, 16 dateIsValid,
17 doubleFollow, 17 doubleFollow,
18 flushAndRunServer,
18 flushAndRunMultipleServers, 19 flushAndRunMultipleServers,
19 getLocalVideos, 20 getLocalVideos,
20 getVideo, 21 getVideo,
@@ -938,7 +939,51 @@ describe('Test multiple servers', function () {
938 } 939 }
939 }) 940 })
940 941
942 it('Should retrieve all comments when subscribing to a new server', async function () {
943 this.timeout(120000)
944
945 const newServer = await flushAndRunServer(4)
946
947 await setAccessTokensToServers([newServer])
948 await doubleFollow(newServer, servers[0])
949 await doubleFollow(newServer, servers[2])
950 await waitJobs([newServer, ...servers])
951
952 const res = await getVideoCommentThreads(newServer.url, videoUUID, 0, 5)
953
954 expect(res.body.total).to.equal(2)
955 expect(res.body.data).to.be.an('array')
956 expect(res.body.data).to.have.lengthOf(2)
957
958 {
959 const comment: VideoComment = res.body.data[0]
960 expect(comment).to.not.be.undefined
961 expect(comment.inReplyToCommentId).to.be.null
962 expect(comment.account.name).to.equal('root')
963 expect(comment.account.host).to.equal('localhost:' + servers[2].port)
964 expect(comment.totalReplies).to.equal(0)
965 expect(dateIsValid(comment.createdAt as string)).to.be.true
966 expect(dateIsValid(comment.updatedAt as string)).to.be.true
967 }
968
969 {
970 const deletedComment: VideoComment = res.body.data[1]
971 expect(deletedComment).to.not.be.undefined
972 expect(deletedComment.isDeleted).to.be.true
973 expect(deletedComment.deletedAt).to.not.be.null
974 expect(deletedComment.text).to.equal('')
975 expect(deletedComment.inReplyToCommentId).to.be.null
976 expect(deletedComment.account).to.be.null
977 expect(deletedComment.totalReplies).to.equal(3)
978 expect(dateIsValid(deletedComment.createdAt as string)).to.be.true
979 expect(dateIsValid(deletedComment.updatedAt as string)).to.be.true
980 expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true
981 }
982 })
983
941 it('Should delete a remote thread by the origin server', async function () { 984 it('Should delete a remote thread by the origin server', async function () {
985 this.timeout(5000)
986
942 const res = await getVideoCommentThreads(servers[ 0 ].url, videoUUID, 0, 5) 987 const res = await getVideoCommentThreads(servers[ 0 ].url, videoUUID, 0, 5)
943 const threadId = res.body.data.find(c => c.text === 'my super second comment').id 988 const threadId = res.body.data.find(c => c.text === 'my super second comment').id
944 await deleteVideoComment(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, threadId) 989 await deleteVideoComment(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, threadId)