diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-16 13:49:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-16 13:57:14 +0100 |
commit | 19149d45b8f68569535f7188ef25e09e3d62c8b4 (patch) | |
tree | 92da0e0db2b0e277b2110a630f502433c86c9119 /server/tests/api/videos | |
parent | 8872828d59a5152e27734711ae30ebe86e84f570 (diff) | |
parent | f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34 (diff) | |
download | PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.tar.gz PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.tar.zst PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.zip |
Merge branch 'feature/admin-comments' into develop
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 2 | ||||
-rw-r--r-- | server/tests/api/videos/video-comments.ts | 356 | ||||
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 4 |
3 files changed, 214 insertions, 148 deletions
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..141a80690 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
5 | import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' | 4 | import * as chai from 'chai' |
5 | |||
6 | import { cleanupTests, testImage } from '../../../../shared/extra-utils' | 6 | import { cleanupTests, testImage } from '../../../../shared/extra-utils' |
7 | import { | 7 | import { |
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' |
25 | import { VideoComment, VideoCommentAdmin, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' | ||
24 | 26 | ||
25 | const expect = chai.expect | 27 | const 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 | |
120 | expect(rootComment.videoId).to.equal(videoId) | 121 | const rootComment = res.body.comment |
121 | expect(dateIsValid(rootComment.createdAt as string)).to.be.true | 122 | expect(rootComment.inReplyToCommentId).to.be.null |
122 | expect(dateIsValid(rootComment.updatedAt as string)).to.be.true | 123 | expect(rootComment.text).equal('my super first comment') |
123 | }) | 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 | }) | ||
124 | 128 | ||
125 | it('Should create multiple replies in this thread', async function () { | 129 | it('Should create multiple replies in this thread', async function () { |
126 | const text1 = 'my super answer to thread 1' | 130 | const text1 = 'my super answer to thread 1' |
127 | const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text1) | 131 | const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text1) |
128 | const childCommentId = childCommentRes.body.comment.id | 132 | const childCommentId = childCommentRes.body.comment.id |
129 | 133 | ||
130 | const text2 = 'my super answer to answer of thread 1' | 134 | const text2 = 'my super answer to answer of thread 1' |
131 | await addVideoCommentReply(server.url, server.accessToken, videoId, childCommentId, text2) | 135 | await addVideoCommentReply(server.url, server.accessToken, videoId, childCommentId, text2) |
132 | 136 | ||
133 | const text3 = 'my second answer to thread 1' | 137 | const text3 = 'my second answer to thread 1' |
134 | await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text3) | 138 | await addVideoCommentReply(server.url, server.accessToken, videoId, threadId, text3) |
135 | }) | 139 | }) |
136 | 140 | ||
137 | it('Should get correctly the replies', async function () { | 141 | it('Should get correctly the replies', async function () { |
138 | const res = await getVideoThreadComments(server.url, videoUUID, threadId) | 142 | const res = await getVideoThreadComments(server.url, videoUUID, threadId) |
139 | 143 | ||
140 | const tree: VideoCommentThreadTree = res.body | 144 | const tree: VideoCommentThreadTree = res.body |
141 | expect(tree.comment.text).equal('my super first comment') | 145 | expect(tree.comment.text).equal('my super first comment') |
142 | expect(tree.children).to.have.lengthOf(2) | 146 | expect(tree.children).to.have.lengthOf(2) |
143 | 147 | ||
144 | const firstChild = tree.children[0] | 148 | const firstChild = tree.children[0] |
145 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') | 149 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') |
146 | expect(firstChild.children).to.have.lengthOf(1) | 150 | expect(firstChild.children).to.have.lengthOf(1) |
147 | 151 | ||
148 | const childOfFirstChild = firstChild.children[0] | 152 | const childOfFirstChild = firstChild.children[0] |
149 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') | 153 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') |
150 | expect(childOfFirstChild.children).to.have.lengthOf(0) | 154 | expect(childOfFirstChild.children).to.have.lengthOf(0) |
151 | 155 | ||
152 | const secondChild = tree.children[1] | 156 | const secondChild = tree.children[1] |
153 | expect(secondChild.comment.text).to.equal('my second answer to thread 1') | 157 | expect(secondChild.comment.text).to.equal('my second answer to thread 1') |
154 | expect(secondChild.children).to.have.lengthOf(0) | 158 | expect(secondChild.children).to.have.lengthOf(0) |
155 | 159 | ||
156 | replyToDeleteId = secondChild.comment.id | 160 | replyToDeleteId = secondChild.comment.id |
157 | }) | 161 | }) |
158 | 162 | ||
159 | it('Should create other threads', async function () { | 163 | it('Should create other threads', async function () { |
160 | const text1 = 'super thread 2' | 164 | const text1 = 'super thread 2' |
161 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text1) | 165 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text1) |
162 | 166 | ||
163 | const text2 = 'super thread 3' | 167 | const text2 = 'super thread 3' |
164 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text2) | 168 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text2) |
165 | }) | 169 | }) |
166 | 170 | ||
167 | it('Should list the threads', async function () { | 171 | it('Should list the threads', async function () { |
168 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') | 172 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') |
169 | 173 | ||
170 | expect(res.body.total).to.equal(3) | 174 | expect(res.body.total).to.equal(3) |
171 | expect(res.body.data).to.be.an('array') | 175 | expect(res.body.data).to.be.an('array') |
172 | expect(res.body.data).to.have.lengthOf(3) | 176 | expect(res.body.data).to.have.lengthOf(3) |
173 | 177 | ||
174 | expect(res.body.data[0].text).to.equal('my super first comment') | 178 | expect(res.body.data[0].text).to.equal('my super first comment') |
175 | expect(res.body.data[0].totalReplies).to.equal(3) | 179 | expect(res.body.data[0].totalReplies).to.equal(3) |
176 | expect(res.body.data[1].text).to.equal('super thread 2') | 180 | expect(res.body.data[1].text).to.equal('super thread 2') |
177 | expect(res.body.data[1].totalReplies).to.equal(0) | 181 | expect(res.body.data[1].totalReplies).to.equal(0) |
178 | expect(res.body.data[2].text).to.equal('super thread 3') | 182 | expect(res.body.data[2].text).to.equal('super thread 3') |
179 | expect(res.body.data[2].totalReplies).to.equal(0) | 183 | expect(res.body.data[2].totalReplies).to.equal(0) |
180 | }) | 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 | }) |
206 | 210 | ||
207 | it('Should delete a complete thread', async function () { | 211 | it('Should delete a complete thread', async function () { |
208 | await deleteVideoComment(server.url, server.accessToken, videoId, threadId) | 212 | await deleteVideoComment(server.url, server.accessToken, videoId, threadId) |
209 | 213 | ||
210 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') | 214 | const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5, 'createdAt') |
211 | expect(res.body.total).to.equal(3) | 215 | expect(res.body.total).to.equal(3) |
212 | expect(res.body.data).to.be.an('array') | 216 | expect(res.body.data).to.be.an('array') |
213 | expect(res.body.data).to.have.lengthOf(3) | 217 | expect(res.body.data).to.have.lengthOf(3) |
214 | 218 | ||
215 | expect(res.body.data[0].text).to.equal('') | 219 | expect(res.body.data[0].text).to.equal('') |
216 | expect(res.body.data[0].isDeleted).to.be.true | 220 | expect(res.body.data[0].isDeleted).to.be.true |
217 | expect(res.body.data[0].deletedAt).to.not.be.null | 221 | expect(res.body.data[0].deletedAt).to.not.be.null |
218 | expect(res.body.data[0].account).to.be.null | 222 | expect(res.body.data[0].account).to.be.null |
219 | expect(res.body.data[0].totalReplies).to.equal(3) | 223 | expect(res.body.data[0].totalReplies).to.equal(3) |
220 | expect(res.body.data[1].text).to.equal('super thread 2') | 224 | expect(res.body.data[1].text).to.equal('super thread 2') |
221 | expect(res.body.data[1].totalReplies).to.equal(0) | 225 | expect(res.body.data[1].totalReplies).to.equal(0) |
222 | expect(res.body.data[2].text).to.equal('super thread 3') | 226 | expect(res.body.data[2].text).to.equal('super thread 3') |
223 | expect(res.body.data[2].totalReplies).to.equal(0) | 227 | expect(res.body.data[2].totalReplies).to.equal(0) |
228 | }) | ||
229 | |||
230 | it('Should count replies from the video author correctly', async function () { | ||
231 | const text = 'my super first comment' | ||
232 | await addVideoCommentThread(server.url, server.accessToken, videoUUID, text) | ||
233 | let res = await getVideoCommentThreads(server.url, videoUUID, 0, 5) | ||
234 | const comment: VideoComment = res.body.data[0] | ||
235 | const threadId2 = comment.threadId | ||
236 | |||
237 | const text2 = 'a first answer to thread 4 by a third party' | ||
238 | await addVideoCommentReply(server.url, userAccessTokenServer1, videoId, threadId2, text2) | ||
239 | |||
240 | const text3 = 'my second answer to thread 4' | ||
241 | await addVideoCommentReply(server.url, server.accessToken, videoId, threadId2, text3) | ||
242 | |||
243 | res = await getVideoThreadComments(server.url, videoUUID, threadId2) | ||
244 | const tree: VideoCommentThreadTree = res.body | ||
245 | expect(tree.comment.totalReplies).to.equal(tree.comment.totalRepliesFromVideoAuthor + 1) | ||
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 }) | ||
232 | 269 | ||
233 | const text2 = 'a first answer to thread 4 by a third party' | 270 | expect(comments).to.have.lengthOf(0) |
234 | await addVideoCommentReply(server.url, userAccessTokenServer1, videoId, threadId2, text2) | 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 | }) | ||
282 | |||
283 | it('Should search instance comments by video', async function () { | ||
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 () { |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 0bfb5bcd4..b194665ba 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -628,7 +628,7 @@ describe('Test video playlists', function () { | |||
628 | let video3: string | 628 | let video3: string |
629 | 629 | ||
630 | before(async function () { | 630 | before(async function () { |
631 | this.timeout(30000) | 631 | this.timeout(60000) |
632 | 632 | ||
633 | groupUser1 = [ Object.assign({}, servers[0], { accessToken: userAccessTokenServer1 }) ] | 633 | groupUser1 = [ Object.assign({}, servers[0], { accessToken: userAccessTokenServer1 }) ] |
634 | groupWithoutToken1 = [ Object.assign({}, servers[0], { accessToken: undefined }) ] | 634 | groupWithoutToken1 = [ Object.assign({}, servers[0], { accessToken: undefined }) ] |
@@ -656,6 +656,8 @@ describe('Test video playlists', function () { | |||
656 | video2 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video 90' })).uuid | 656 | video2 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video 90' })).uuid |
657 | video3 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video 91', nsfw: true })).uuid | 657 | video3 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video 91', nsfw: true })).uuid |
658 | 658 | ||
659 | await waitJobs(servers) | ||
660 | |||
659 | await addVideo({ videoId: video1, startTimestamp: 15, stopTimestamp: 28 }) | 661 | await addVideo({ videoId: video1, startTimestamp: 15, stopTimestamp: 28 }) |
660 | await addVideo({ videoId: video2, startTimestamp: 35 }) | 662 | await addVideo({ videoId: video2, startTimestamp: 35 }) |
661 | await addVideo({ videoId: video3 }) | 663 | await addVideo({ videoId: video3 }) |