aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-16 11:55:17 +0100
committerChocobozzz <me@florianbigard.com>2020-11-16 13:48:58 +0100
commitf1273314593a4a7dc7ec9594ce0c6c3ae8f62b34 (patch)
treecf1f3949e64a24a820833950d7b2bbf9ccd40013 /server/tests/api
parent0f8d00e3144060270d7fe603865fccaf18649c47 (diff)
downloadPeerTube-f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34.tar.gz
PeerTube-f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34.tar.zst
PeerTube-f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34.zip
Add admin view to manage comments
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/users.ts12
-rw-r--r--server/tests/api/check-params/video-comments.ts48
-rw-r--r--server/tests/api/videos/multiple-servers.ts2
-rw-r--r--server/tests/api/videos/video-comments.ts354
4 files changed, 258 insertions, 158 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 3e53c445d..2a220be83 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -154,18 +154,6 @@ describe('Test users API validators', function () {
154 await checkBadSortPagination(server.url, path, server.accessToken) 154 await checkBadSortPagination(server.url, path, server.accessToken)
155 }) 155 })
156 156
157 it('Should fail with a bad blocked/banned user filter', async function () {
158 await makeGetRequest({
159 url: server.url,
160 path,
161 query: {
162 blocked: 42
163 },
164 token: server.accessToken,
165 statusCodeExpected: 400
166 })
167 })
168
169 it('Should fail with a non authenticated user', async function () { 157 it('Should fail with a non authenticated user', async function () {
170 await makeGetRequest({ 158 await makeGetRequest({
171 url: server.url, 159 url: server.url,
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index 181282ce1..662d4a70d 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -296,6 +296,54 @@ describe('Test video comments API validator', function () {
296 it('Should return conflict on comment thread add') 296 it('Should return conflict on comment thread add')
297 }) 297 })
298 298
299 describe('When listing admin comments threads', function () {
300 const path = '/api/v1/videos/comments'
301
302 it('Should fail with a bad start pagination', async function () {
303 await checkBadStartPagination(server.url, path, server.accessToken)
304 })
305
306 it('Should fail with a bad count pagination', async function () {
307 await checkBadCountPagination(server.url, path, server.accessToken)
308 })
309
310 it('Should fail with an incorrect sort', async function () {
311 await checkBadSortPagination(server.url, path, server.accessToken)
312 })
313
314 it('Should fail with a non authenticated user', async function () {
315 await makeGetRequest({
316 url: server.url,
317 path,
318 statusCodeExpected: 401
319 })
320 })
321
322 it('Should fail with a non admin user', async function () {
323 await makeGetRequest({
324 url: server.url,
325 path,
326 token: userAccessToken,
327 statusCodeExpected: 403
328 })
329 })
330
331 it('Should succeed with the correct params', async function () {
332 await makeGetRequest({
333 url: server.url,
334 path,
335 token: server.accessToken,
336 query: {
337 isLocal: false,
338 search: 'toto',
339 searchAccount: 'toto',
340 searchVideo: 'toto'
341 },
342 statusCodeExpected: 200
343 })
344 })
345 })
346
299 after(async function () { 347 after(async function () {
300 await cleanupTests([ server ]) 348 await cleanupTests([ server ])
301 }) 349 })
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index d7b04373f..c90fd09fb 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -158,7 +158,7 @@ describe('Test multiple servers', function () {
158 }) 158 })
159 159
160 it('Should upload the video on server 2 and propagate on each server', async function () { 160 it('Should upload the video on server 2 and propagate on each server', async function () {
161 this.timeout(50000) 161 this.timeout(100000)
162 162
163 const user = { 163 const user = {
164 username: 'user1', 164 username: 'user1',
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index afb58e95a..18a86bead 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 5import { VideoComment, VideoCommentAdmin, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
6import { cleanupTests, testImage } from '../../../../shared/extra-utils' 6import { cleanupTests, testImage } from '../../../../shared/extra-utils'
7import { 7import {
8 createUser, 8 createUser,
@@ -18,9 +18,11 @@ import {
18 addVideoCommentReply, 18 addVideoCommentReply,
19 addVideoCommentThread, 19 addVideoCommentThread,
20 deleteVideoComment, 20 deleteVideoComment,
21 getAdminVideoComments,
21 getVideoCommentThreads, 22 getVideoCommentThreads,
22 getVideoThreadComments 23 getVideoThreadComments
23} from '../../../../shared/extra-utils/videos/video-comments' 24} from '../../../../shared/extra-utils/videos/video-comments'
25import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
24 26
25const expect = chai.expect 27const expect = chai.expect
26 28
@@ -59,186 +61,248 @@ describe('Test video comments', function () {
59 userAccessTokenServer1 = await getAccessToken(server.url, 'user1', 'password') 61 userAccessTokenServer1 = await getAccessToken(server.url, 'user1', 'password')
60 }) 62 })
61 63
62 it('Should not have threads on this video', async function () { 64 describe('User comments', function () {
63 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
64 65
65 expect(res.body.total).to.equal(0) 66 it('Should not have threads on this video', async function () {
66 expect(res.body.data).to.be.an('array') 67 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
67 expect(res.body.data).to.have.lengthOf(0)
68 })
69 68
70 it('Should create a thread in this video', async function () { 69 expect(res.body.total).to.equal(0)
71 const text = 'my super first comment' 70 expect(res.body.data).to.be.an('array')
72 71 expect(res.body.data).to.have.lengthOf(0)
73 const res = await addVideoCommentThread(server.url, server.accessToken, videoUUID, text) 72 })
74 const comment = res.body.comment
75
76 expect(comment.inReplyToCommentId).to.be.null
77 expect(comment.text).equal('my super first comment')
78 expect(comment.videoId).to.equal(videoId)
79 expect(comment.id).to.equal(comment.threadId)
80 expect(comment.account.name).to.equal('root')
81 expect(comment.account.host).to.equal('localhost:' + server.port)
82 expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root')
83 expect(comment.totalReplies).to.equal(0)
84 expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
85 expect(dateIsValid(comment.createdAt as string)).to.be.true
86 expect(dateIsValid(comment.updatedAt as string)).to.be.true
87 })
88 73
89 it('Should list threads of this video', async function () { 74 it('Should create a thread in this video', async function () {
90 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5) 75 const text = 'my super first comment'
76
77 const res = await addVideoCommentThread(server.url, server.accessToken, videoUUID, text)
78 const comment = res.body.comment
79
80 expect(comment.inReplyToCommentId).to.be.null
81 expect(comment.text).equal('my super first comment')
82 expect(comment.videoId).to.equal(videoId)
83 expect(comment.id).to.equal(comment.threadId)
84 expect(comment.account.name).to.equal('root')
85 expect(comment.account.host).to.equal('localhost:' + server.port)
86 expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root')
87 expect(comment.totalReplies).to.equal(0)
88 expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
89 expect(dateIsValid(comment.createdAt as string)).to.be.true
90 expect(dateIsValid(comment.updatedAt as string)).to.be.true
91 })
91 92
92 expect(res.body.total).to.equal(1) 93 it('Should list threads of this video', async function () {
93 expect(res.body.data).to.be.an('array') 94 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
94 expect(res.body.data).to.have.lengthOf(1)
95 95
96 const comment: VideoComment = res.body.data[0] 96 expect(res.body.total).to.equal(1)
97 expect(comment.inReplyToCommentId).to.be.null 97 expect(res.body.data).to.be.an('array')
98 expect(comment.text).equal('my super first comment') 98 expect(res.body.data).to.have.lengthOf(1)
99 expect(comment.videoId).to.equal(videoId)
100 expect(comment.id).to.equal(comment.threadId)
101 expect(comment.account.name).to.equal('root')
102 expect(comment.account.host).to.equal('localhost:' + server.port)
103 99
104 await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') 100 const comment: VideoComment = res.body.data[0]
101 expect(comment.inReplyToCommentId).to.be.null
102 expect(comment.text).equal('my super first comment')
103 expect(comment.videoId).to.equal(videoId)
104 expect(comment.id).to.equal(comment.threadId)
105 expect(comment.account.name).to.equal('root')
106 expect(comment.account.host).to.equal('localhost:' + server.port)
105 107
106 expect(comment.totalReplies).to.equal(0) 108 await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
107 expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
108 expect(dateIsValid(comment.createdAt as string)).to.be.true
109 expect(dateIsValid(comment.updatedAt as string)).to.be.true
110 109
111 threadId = comment.threadId 110 expect(comment.totalReplies).to.equal(0)
112 }) 111 expect(comment.totalRepliesFromVideoAuthor).to.equal(0)
112 expect(dateIsValid(comment.createdAt as string)).to.be.true
113 expect(dateIsValid(comment.updatedAt as string)).to.be.true
113 114
114 it('Should get all the thread created', async function () { 115 threadId = comment.threadId
115 const res = await getVideoThreadComments(server.url, videoUUID, threadId) 116 })
116 117
117 const rootComment = res.body.comment 118 it('Should get all the thread created', async function () {
118 expect(rootComment.inReplyToCommentId).to.be.null 119 const res = await getVideoThreadComments(server.url, videoUUID, threadId)
119 expect(rootComment.text).equal('my super first comment')
120 expect(rootComment.videoId).to.equal(videoId)
121 expect(dateIsValid(rootComment.createdAt as string)).to.be.true
122 expect(dateIsValid(rootComment.updatedAt as string)).to.be.true
123 })
124 120
125 it('Should create multiple replies in this thread', async function () { 121 const rootComment = res.body.comment
126 const text1 = 'my super answer to thread 1' 122 expect(rootComment.inReplyToCommentId).to.be.null
127 const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text1) 123 expect(rootComment.text).equal('my super first comment')
128 const childCommentId = childCommentRes.body.comment.id 124 expect(rootComment.videoId).to.equal(videoId)
125 expect(dateIsValid(rootComment.createdAt as string)).to.be.true
126 expect(dateIsValid(rootComment.updatedAt as string)).to.be.true
127 })
129 128
130 const text2 = 'my super answer to answer of thread 1' 129 it('Should create multiple replies in this thread', async function () {
131 await addVideoCommentReply(server.url, server.accessToken, videoId, childCommentId, text2) 130 const text1 = 'my super answer to thread 1'
131 const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text1)
132 const childCommentId = childCommentRes.body.comment.id
132 133
133 const text3 = 'my second answer to thread 1' 134 const text2 = 'my super answer to answer of thread 1'
134 await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text3) 135 await addVideoCommentReply(server.url, server.accessToken, videoId, childCommentId, text2)
135 })
136 136
137 it('Should get correctly the replies', async function () { 137 const text3 = 'my second answer to thread 1'
138 const res = await getVideoThreadComments(server.url, videoUUID, threadId) 138 await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text3)
139 })
139 140
140 const tree: VideoCommentThreadTree = res.body 141 it('Should get correctly the replies', async function () {
141 expect(tree.comment.text).equal('my super first comment') 142 const res = await getVideoThreadComments(server.url, videoUUID, threadId)
142 expect(tree.children).to.have.lengthOf(2)
143 143
144 const firstChild = tree.children[0] 144 const tree: VideoCommentThreadTree = res.body
145 expect(firstChild.comment.text).to.equal('my super answer to thread 1') 145 expect(tree.comment.text).equal('my super first comment')
146 expect(firstChild.children).to.have.lengthOf(1) 146 expect(tree.children).to.have.lengthOf(2)
147 147
148 const childOfFirstChild = firstChild.children[0] 148 const firstChild = tree.children[0]
149 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') 149 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
150 expect(childOfFirstChild.children).to.have.lengthOf(0) 150 expect(firstChild.children).to.have.lengthOf(1)
151 151
152 const secondChild = tree.children[1] 152 const childOfFirstChild = firstChild.children[0]
153 expect(secondChild.comment.text).to.equal('my second answer to thread 1') 153 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
154 expect(secondChild.children).to.have.lengthOf(0) 154 expect(childOfFirstChild.children).to.have.lengthOf(0)
155 155
156 replyToDeleteId = secondChild.comment.id 156 const secondChild = tree.children[1]
157 }) 157 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
158 expect(secondChild.children).to.have.lengthOf(0)
158 159
159 it('Should create other threads', async function () { 160 replyToDeleteId = secondChild.comment.id
160 const text1 = 'super thread 2' 161 })
161 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text1)
162 162
163 const text2 = 'super thread 3' 163 it('Should create other threads', async function () {
164 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text2) 164 const text1 = 'super thread 2'
165 }) 165 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text1)
166 166
167 it('Should list the threads', async function () { 167 const text2 = 'super thread 3'
168 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') 168 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text2)
169 })
169 170
170 expect(res.body.total).to.equal(3) 171 it('Should list the threads', async function () {
171 expect(res.body.data).to.be.an('array') 172 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt')
172 expect(res.body.data).to.have.lengthOf(3)
173 173
174 expect(res.body.data[0].text).to.equal('my super first comment') 174 expect(res.body.total).to.equal(3)
175 expect(res.body.data[0].totalReplies).to.equal(3) 175 expect(res.body.data).to.be.an('array')
176 expect(res.body.data[1].text).to.equal('super thread 2') 176 expect(res.body.data).to.have.lengthOf(3)
177 expect(res.body.data[1].totalReplies).to.equal(0) 177
178 expect(res.body.data[2].text).to.equal('super thread 3') 178 expect(res.body.data[0].text).to.equal('my super first comment')
179 expect(res.body.data[2].totalReplies).to.equal(0) 179 expect(res.body.data[0].totalReplies).to.equal(3)
180 }) 180 expect(res.body.data[1].text).to.equal('super thread 2')
181 expect(res.body.data[1].totalReplies).to.equal(0)
182 expect(res.body.data[2].text).to.equal('super thread 3')
183 expect(res.body.data[2].totalReplies).to.equal(0)
184 })
181 185
182 it('Should delete a reply', async function () { 186 it('Should delete a reply', async function () {
183 await deleteVideoComment(server.url, server.accessToken, videoId, replyToDeleteId) 187 await deleteVideoComment(server.url, server.accessToken, videoId, replyToDeleteId)
184 188
185 const res = await getVideoThreadComments(server.url, videoUUID, threadId) 189 const res = await getVideoThreadComments(server.url, videoUUID, threadId)
186 190
187 const tree: VideoCommentThreadTree = res.body 191 const tree: VideoCommentThreadTree = res.body
188 expect(tree.comment.text).equal('my super first comment') 192 expect(tree.comment.text).equal('my super first comment')
189 expect(tree.children).to.have.lengthOf(2) 193 expect(tree.children).to.have.lengthOf(2)
190 194
191 const firstChild = tree.children[0] 195 const firstChild = tree.children[0]
192 expect(firstChild.comment.text).to.equal('my super answer to thread 1') 196 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
193 expect(firstChild.children).to.have.lengthOf(1) 197 expect(firstChild.children).to.have.lengthOf(1)
194 198
195 const childOfFirstChild = firstChild.children[0] 199 const childOfFirstChild = firstChild.children[0]
196 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') 200 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
197 expect(childOfFirstChild.children).to.have.lengthOf(0) 201 expect(childOfFirstChild.children).to.have.lengthOf(0)
198 202
199 const deletedChildOfFirstChild = tree.children[1] 203 const deletedChildOfFirstChild = tree.children[1]
200 expect(deletedChildOfFirstChild.comment.text).to.equal('') 204 expect(deletedChildOfFirstChild.comment.text).to.equal('')
201 expect(deletedChildOfFirstChild.comment.isDeleted).to.be.true 205 expect(deletedChildOfFirstChild.comment.isDeleted).to.be.true
202 expect(deletedChildOfFirstChild.comment.deletedAt).to.not.be.null 206 expect(deletedChildOfFirstChild.comment.deletedAt).to.not.be.null
203 expect(deletedChildOfFirstChild.comment.account).to.be.null 207 expect(deletedChildOfFirstChild.comment.account).to.be.null
204 expect(deletedChildOfFirstChild.children).to.have.lengthOf(0) 208 expect(deletedChildOfFirstChild.children).to.have.lengthOf(0)
205 }) 209 })
210
211 it('Should delete a complete thread', async function () {
212 await deleteVideoComment(server.url, server.accessToken, videoId, threadId)
213
214 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt')
215 expect(res.body.total).to.equal(3)
216 expect(res.body.data).to.be.an('array')
217 expect(res.body.data).to.have.lengthOf(3)
218
219 expect(res.body.data[0].text).to.equal('')
220 expect(res.body.data[0].isDeleted).to.be.true
221 expect(res.body.data[0].deletedAt).to.not.be.null
222 expect(res.body.data[0].account).to.be.null
223 expect(res.body.data[0].totalReplies).to.equal(3)
224 expect(res.body.data[1].text).to.equal('super thread 2')
225 expect(res.body.data[1].totalReplies).to.equal(0)
226 expect(res.body.data[2].text).to.equal('super thread 3')
227 expect(res.body.data[2].totalReplies).to.equal(0)
228 })
206 229
207 it('Should delete a complete thread', async function () { 230 it('Should count replies from the video author correctly', async function () {
208 await deleteVideoComment(server.url, server.accessToken, videoId, threadId) 231 const text = 'my super first comment'
209 232 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text)
210 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') 233 let res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
211 expect(res.body.total).to.equal(3) 234 const comment: VideoComment = res.body.data[0]
212 expect(res.body.data).to.be.an('array') 235 const threadId2 = comment.threadId
213 expect(res.body.data).to.have.lengthOf(3) 236
214 237 const text2 = 'a first answer to thread 4 by a third party'
215 expect(res.body.data[0].text).to.equal('') 238 await addVideoCommentReply(server.url, userAccessTokenServer1, videoId, threadId2, text2)
216 expect(res.body.data[0].isDeleted).to.be.true 239
217 expect(res.body.data[0].deletedAt).to.not.be.null 240 const text3 = 'my second answer to thread 4'
218 expect(res.body.data[0].account).to.be.null 241 await addVideoCommentReply(server.url, server.accessToken, videoId, threadId2, text3)
219 expect(res.body.data[0].totalReplies).to.equal(3) 242
220 expect(res.body.data[1].text).to.equal('super thread 2') 243 res = await getVideoThreadComments(server.url, videoUUID, threadId2)
221 expect(res.body.data[1].totalReplies).to.equal(0) 244 const tree: VideoCommentThreadTree = res.body
222 expect(res.body.data[2].text).to.equal('super thread 3') 245 expect(tree.comment.totalReplies).to.equal(tree.comment.totalRepliesFromVideoAuthor + 1)
223 expect(res.body.data[2].totalReplies).to.equal(0) 246 })
224 }) 247 })
225 248
226 it('Should count replies from the video author correctly', async function () { 249 describe('All instance comments', function () {
227 const text = 'my super first comment' 250 async function getComments (options: any = {}) {
228 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text) 251 const res = await getAdminVideoComments(Object.assign({
229 let res = await getVideoCommentThreads(server.url, videoUUID, 0, 5) 252 url: server.url,
230 const comment: VideoComment = res.body.data[0] 253 token: server.accessToken,
231 const threadId2 = comment.threadId 254 start: 0,
255 count: 10
256 }, options))
257
258 return { comments: res.body.data as VideoCommentAdmin[], total: res.body.total as number }
259 }
260
261 it('Should list instance comments as admin', async function () {
262 const { comments } = await getComments({ start: 0, count: 1 })
263
264 expect(comments[0].text).to.equal('my second answer to thread 4')
265 })
266
267 it('Should filter instance comments by isLocal', async function () {
268 const { total, comments } = await getComments({ isLocal: false })
269
270 expect(comments).to.have.lengthOf(0)
271 expect(total).to.equal(0)
272 })
273
274 it('Should search instance comments by account', async function () {
275 const { total, comments } = await getComments({ searchAccount: 'user' })
276
277 expect(comments).to.have.lengthOf(1)
278 expect(total).to.equal(1)
279
280 expect(comments[0].text).to.equal('a first answer to thread 4 by a third party')
281 })
232 282
233 const text2 = 'a first answer to thread 4 by a third party' 283 it('Should search instance comments by video', async function () {
234 await addVideoCommentReply(server.url, userAccessTokenServer1, videoId, threadId2, text2) 284 {
285 const { total, comments } = await getComments({ searchVideo: 'video' })
235 286
236 const text3 = 'my second answer to thread 4' 287 expect(comments).to.have.lengthOf(7)
237 await addVideoCommentReply(server.url, server.accessToken, videoId, threadId2, text3) 288 expect(total).to.equal(7)
289 }
238 290
239 res = await getVideoThreadComments(server.url, videoUUID, threadId2) 291 {
240 const tree: VideoCommentThreadTree = res.body 292 const { total, comments } = await getComments({ searchVideo: 'hello' })
241 expect(tree.comment.totalReplies).to.equal(tree.comment.totalRepliesFromVideoAuthor + 1) 293
294 expect(comments).to.have.lengthOf(0)
295 expect(total).to.equal(0)
296 }
297 })
298
299 it('Should search instance comments', async function () {
300 const { total, comments } = await getComments({ search: 'super thread 3' })
301
302 expect(comments).to.have.lengthOf(1)
303 expect(total).to.equal(1)
304 expect(comments[0].text).to.equal('super thread 3')
305 })
242 }) 306 })
243 307
244 after(async function () { 308 after(async function () {