diff options
author | Julien Maulny <julien.maulny@protonmail.com> | 2019-11-15 19:05:08 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-12-04 09:36:45 +0100 |
commit | 69222afac8f8c41d90295b33f0695bbff352851e (patch) | |
tree | 63fe1faea94dd3bfc54e633631eecb275c969e54 /server/tests/api/videos/video-comments.ts | |
parent | 69c7f7525ddf13b7ced787d8b72ac74b43665517 (diff) | |
download | PeerTube-69222afac8f8c41d90295b33f0695bbff352851e.tar.gz PeerTube-69222afac8f8c41d90295b33f0695bbff352851e.tar.zst PeerTube-69222afac8f8c41d90295b33f0695bbff352851e.zip |
Soft delete video comments instead of detroy
Diffstat (limited to 'server/tests/api/videos/video-comments.ts')
-rw-r--r-- | server/tests/api/videos/video-comments.ts | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 82182cc7c..95be14c0e 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -172,7 +172,7 @@ describe('Test video comments', function () { | |||
172 | 172 | ||
173 | const tree: VideoCommentThreadTree = res.body | 173 | const tree: VideoCommentThreadTree = res.body |
174 | expect(tree.comment.text).equal('my super first comment') | 174 | expect(tree.comment.text).equal('my super first comment') |
175 | expect(tree.children).to.have.lengthOf(1) | 175 | expect(tree.children).to.have.lengthOf(2) |
176 | 176 | ||
177 | const firstChild = tree.children[0] | 177 | const firstChild = tree.children[0] |
178 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') | 178 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') |
@@ -181,20 +181,32 @@ describe('Test video comments', function () { | |||
181 | const childOfFirstChild = firstChild.children[0] | 181 | const childOfFirstChild = firstChild.children[0] |
182 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') | 182 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') |
183 | expect(childOfFirstChild.children).to.have.lengthOf(0) | 183 | expect(childOfFirstChild.children).to.have.lengthOf(0) |
184 | |||
185 | const deletedChildOfFirstChild = tree.children[1] | ||
186 | expect(deletedChildOfFirstChild.comment.text).to.equal('') | ||
187 | expect(deletedChildOfFirstChild.comment.isDeleted).to.be.true | ||
188 | expect(deletedChildOfFirstChild.comment.deletedAt).to.not.be.null | ||
189 | expect(deletedChildOfFirstChild.comment.account).to.be.null | ||
190 | expect(deletedChildOfFirstChild.children).to.have.lengthOf(0) | ||
184 | }) | 191 | }) |
185 | 192 | ||
186 | it('Should delete a complete thread', async function () { | 193 | it('Should delete a complete thread', async function () { |
187 | await deleteVideoComment(server.url, server.accessToken, videoId, threadId) | 194 | await deleteVideoComment(server.url, server.accessToken, videoId, threadId) |
188 | 195 | ||
189 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') | 196 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') |
190 | expect(res.body.total).to.equal(2) | 197 | expect(res.body.total).to.equal(3) |
191 | expect(res.body.data).to.be.an('array') | 198 | expect(res.body.data).to.be.an('array') |
192 | expect(res.body.data).to.have.lengthOf(2) | 199 | expect(res.body.data).to.have.lengthOf(3) |
193 | 200 | ||
194 | expect(res.body.data[0].text).to.equal('super thread 2') | 201 | expect(res.body.data[0].text).to.equal('') |
195 | expect(res.body.data[0].totalReplies).to.equal(0) | 202 | expect(res.body.data[0].isDeleted).to.be.true |
196 | expect(res.body.data[1].text).to.equal('super thread 3') | 203 | expect(res.body.data[0].deletedAt).to.not.be.null |
204 | expect(res.body.data[0].account).to.be.null | ||
205 | expect(res.body.data[0].totalReplies).to.equal(3) | ||
206 | expect(res.body.data[1].text).to.equal('super thread 2') | ||
197 | expect(res.body.data[1].totalReplies).to.equal(0) | 207 | expect(res.body.data[1].totalReplies).to.equal(0) |
208 | expect(res.body.data[2].text).to.equal('super thread 3') | ||
209 | expect(res.body.data[2].totalReplies).to.equal(0) | ||
198 | }) | 210 | }) |
199 | 211 | ||
200 | after(async function () { | 212 | after(async function () { |