aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/multiple-servers.ts
diff options
context:
space:
mode:
authorJulien Maulny <julien.maulny@protonmail.com>2019-11-15 19:05:08 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-12-04 09:36:45 +0100
commit69222afac8f8c41d90295b33f0695bbff352851e (patch)
tree63fe1faea94dd3bfc54e633631eecb275c969e54 /server/tests/api/videos/multiple-servers.ts
parent69c7f7525ddf13b7ced787d8b72ac74b43665517 (diff)
downloadPeerTube-69222afac8f8c41d90295b33f0695bbff352851e.tar.gz
PeerTube-69222afac8f8c41d90295b33f0695bbff352851e.tar.zst
PeerTube-69222afac8f8c41d90295b33f0695bbff352851e.zip
Soft delete video comments instead of detroy
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r--server/tests/api/videos/multiple-servers.ts56
1 files changed, 48 insertions, 8 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index aeda188c2..e7b57ba1f 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -868,7 +868,7 @@ describe('Test multiple servers', function () {
868 await waitJobs(servers) 868 await waitJobs(servers)
869 }) 869 })
870 870
871 it('Should not have this comment anymore', async function () { 871 it('Should have this comment marked as deleted', async function () {
872 for (const server of servers) { 872 for (const server of servers) {
873 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5) 873 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
874 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id 874 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
@@ -880,7 +880,13 @@ describe('Test multiple servers', function () {
880 880
881 const firstChild = tree.children[0] 881 const firstChild = tree.children[0]
882 expect(firstChild.comment.text).to.equal('my super answer to thread 1') 882 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
883 expect(firstChild.children).to.have.lengthOf(0) 883 expect(firstChild.children).to.have.lengthOf(1)
884
885 const deletedComment = firstChild.children[0].comment
886 expect(deletedComment.isDeleted).to.be.true
887 expect(deletedComment.deletedAt).to.not.be.null
888 expect(deletedComment.account).to.be.null
889 expect(deletedComment.text).to.equal('')
884 890
885 const secondChild = tree.children[1] 891 const secondChild = tree.children[1]
886 expect(secondChild.comment.text).to.equal('my second answer to thread 1') 892 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
@@ -897,13 +903,13 @@ describe('Test multiple servers', function () {
897 await waitJobs(servers) 903 await waitJobs(servers)
898 }) 904 })
899 905
900 it('Should have the threads deleted on other servers too', async function () { 906 it('Should have the threads marked as deleted on other servers too', async function () {
901 for (const server of servers) { 907 for (const server of servers) {
902 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5) 908 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
903 909
904 expect(res.body.total).to.equal(1) 910 expect(res.body.total).to.equal(2)
905 expect(res.body.data).to.be.an('array') 911 expect(res.body.data).to.be.an('array')
906 expect(res.body.data).to.have.lengthOf(1) 912 expect(res.body.data).to.have.lengthOf(2)
907 913
908 { 914 {
909 const comment: VideoComment = res.body.data[0] 915 const comment: VideoComment = res.body.data[0]
@@ -915,6 +921,20 @@ describe('Test multiple servers', function () {
915 expect(dateIsValid(comment.createdAt as string)).to.be.true 921 expect(dateIsValid(comment.createdAt as string)).to.be.true
916 expect(dateIsValid(comment.updatedAt as string)).to.be.true 922 expect(dateIsValid(comment.updatedAt as string)).to.be.true
917 } 923 }
924
925 {
926 const deletedComment: VideoComment = res.body.data[1]
927 expect(deletedComment).to.not.be.undefined
928 expect(deletedComment.isDeleted).to.be.true
929 expect(deletedComment.deletedAt).to.not.be.null
930 expect(deletedComment.text).to.equal('')
931 expect(deletedComment.inReplyToCommentId).to.be.null
932 expect(deletedComment.account).to.be.null
933 expect(deletedComment.totalReplies).to.equal(3)
934 expect(dateIsValid(deletedComment.createdAt as string)).to.be.true
935 expect(dateIsValid(deletedComment.updatedAt as string)).to.be.true
936 expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true
937 }
918 } 938 }
919 }) 939 })
920 940
@@ -926,12 +946,32 @@ describe('Test multiple servers', function () {
926 await waitJobs(servers) 946 await waitJobs(servers)
927 }) 947 })
928 948
929 it('Should have the threads deleted on other servers too', async function () { 949 it('Should have the threads marked as deleted on other servers too', async function () {
930 for (const server of servers) { 950 for (const server of servers) {
931 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5) 951 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
932 952
933 expect(res.body.total).to.equal(0) 953 expect(res.body.total).to.equal(2)
934 expect(res.body.data).to.have.lengthOf(0) 954 expect(res.body.data).to.have.lengthOf(2)
955
956 {
957 const comment: VideoComment = res.body.data[0]
958 expect(comment.text).to.equal('')
959 expect(comment.isDeleted).to.be.true
960 expect(comment.createdAt).to.not.be.null
961 expect(comment.deletedAt).to.not.be.null
962 expect(comment.account).to.be.null
963 expect(comment.totalReplies).to.equal(0)
964 }
965
966 {
967 const comment: VideoComment = res.body.data[1]
968 expect(comment.text).to.equal('')
969 expect(comment.isDeleted).to.be.true
970 expect(comment.createdAt).to.not.be.null
971 expect(comment.deletedAt).to.not.be.null
972 expect(comment.account).to.be.null
973 expect(comment.totalReplies).to.equal(3)
974 }
935 } 975 }
936 }) 976 })
937 977