]>
Commit | Line | Data |
---|---|---|
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | |
2 | ||
3 | import 'mocha' | |
4 | import * as chai from 'chai' | |
5 | import { | |
6 | addVideoCommentReply, | |
7 | addVideoCommentThread, | |
8 | cleanupTests, | |
9 | completeVideoCheck, | |
10 | createUser, | |
11 | createVideoCaption, | |
12 | dateIsValid, | |
13 | deleteVideoComment, | |
14 | expectAccountFollows, | |
15 | flushAndRunMultipleServers, | |
16 | FollowsCommand, | |
17 | getVideoCommentThreads, | |
18 | getVideosList, | |
19 | getVideoThreadComments, | |
20 | listVideoCaptions, | |
21 | rateVideo, | |
22 | ServerInfo, | |
23 | setAccessTokensToServers, | |
24 | testCaptionFile, | |
25 | uploadVideo, | |
26 | userLogin, | |
27 | waitJobs | |
28 | } from '@shared/extra-utils' | |
29 | import { Video, VideoCaption, VideoComment, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' | |
30 | ||
31 | const expect = chai.expect | |
32 | ||
33 | describe('Test follows', function () { | |
34 | let servers: ServerInfo[] = [] | |
35 | let followsCommands: FollowsCommand[] | |
36 | ||
37 | before(async function () { | |
38 | this.timeout(30000) | |
39 | ||
40 | servers = await flushAndRunMultipleServers(3) | |
41 | followsCommands = servers.map(s => s.followsCommand) | |
42 | ||
43 | // Get the access tokens | |
44 | await setAccessTokensToServers(servers) | |
45 | }) | |
46 | ||
47 | it('Should not have followers', async function () { | |
48 | for (const server of servers) { | |
49 | const body = await server.followsCommand.getFollowers({ start: 0, count: 5, sort: 'createdAt' }) | |
50 | expect(body.total).to.equal(0) | |
51 | ||
52 | const follows = body.data | |
53 | expect(follows).to.be.an('array') | |
54 | expect(follows.length).to.equal(0) | |
55 | } | |
56 | }) | |
57 | ||
58 | it('Should not have following', async function () { | |
59 | for (const server of servers) { | |
60 | const body = await server.followsCommand.getFollowings({ start: 0, count: 5, sort: 'createdAt' }) | |
61 | expect(body.total).to.equal(0) | |
62 | ||
63 | const follows = body.data | |
64 | expect(follows).to.be.an('array') | |
65 | expect(follows.length).to.equal(0) | |
66 | } | |
67 | }) | |
68 | ||
69 | it('Should have server 1 following server 2 and 3', async function () { | |
70 | this.timeout(30000) | |
71 | ||
72 | await followsCommands[0].follow({ targets: [ servers[1].url, servers[2].url ] }) | |
73 | ||
74 | await waitJobs(servers) | |
75 | }) | |
76 | ||
77 | it('Should have 2 followings on server 1', async function () { | |
78 | const body = await followsCommands[0].getFollowings({ start: 0, count: 1, sort: 'createdAt' }) | |
79 | expect(body.total).to.equal(2) | |
80 | ||
81 | let follows = body.data | |
82 | expect(follows).to.be.an('array') | |
83 | expect(follows.length).to.equal(1) | |
84 | ||
85 | const body2 = await followsCommands[0].getFollowings({ start: 1, count: 1, sort: 'createdAt' }) | |
86 | follows = follows.concat(body2.data) | |
87 | ||
88 | const server2Follow = follows.find(f => f.following.host === 'localhost:' + servers[1].port) | |
89 | const server3Follow = follows.find(f => f.following.host === 'localhost:' + servers[2].port) | |
90 | ||
91 | expect(server2Follow).to.not.be.undefined | |
92 | expect(server3Follow).to.not.be.undefined | |
93 | expect(server2Follow.state).to.equal('accepted') | |
94 | expect(server3Follow.state).to.equal('accepted') | |
95 | }) | |
96 | ||
97 | it('Should search/filter followings on server 1', async function () { | |
98 | const sort = 'createdAt' | |
99 | const start = 0 | |
100 | const count = 1 | |
101 | ||
102 | { | |
103 | const search = ':' + servers[1].port | |
104 | ||
105 | { | |
106 | const body = await followsCommands[0].getFollowings({ start, count, sort, search }) | |
107 | expect(body.total).to.equal(1) | |
108 | ||
109 | const follows = body.data | |
110 | expect(follows.length).to.equal(1) | |
111 | expect(follows[0].following.host).to.equal('localhost:' + servers[1].port) | |
112 | } | |
113 | ||
114 | { | |
115 | const body = await followsCommands[0].getFollowings({ start, count, sort, search, state: 'accepted' }) | |
116 | expect(body.total).to.equal(1) | |
117 | expect(body.data).to.have.lengthOf(1) | |
118 | } | |
119 | ||
120 | { | |
121 | const body = await followsCommands[0].getFollowings({ start, count, sort, search, state: 'accepted', actorType: 'Person' }) | |
122 | expect(body.total).to.equal(0) | |
123 | expect(body.data).to.have.lengthOf(0) | |
124 | } | |
125 | ||
126 | { | |
127 | const body = await followsCommands[0].getFollowings({ | |
128 | start, | |
129 | count, | |
130 | sort, | |
131 | search, | |
132 | state: 'accepted', | |
133 | actorType: 'Application' | |
134 | }) | |
135 | expect(body.total).to.equal(1) | |
136 | expect(body.data).to.have.lengthOf(1) | |
137 | } | |
138 | ||
139 | { | |
140 | const body = await followsCommands[0].getFollowings({ start, count, sort, search, state: 'pending' }) | |
141 | expect(body.total).to.equal(0) | |
142 | expect(body.data).to.have.lengthOf(0) | |
143 | } | |
144 | } | |
145 | ||
146 | { | |
147 | const body = await followsCommands[0].getFollowings({ start, count, sort, search: 'bla' }) | |
148 | expect(body.total).to.equal(0) | |
149 | ||
150 | expect(body.data.length).to.equal(0) | |
151 | } | |
152 | }) | |
153 | ||
154 | it('Should have 0 followings on server 2 and 3', async function () { | |
155 | for (const server of [ servers[1], servers[2] ]) { | |
156 | const body = await server.followsCommand.getFollowings({ start: 0, count: 5, sort: 'createdAt' }) | |
157 | expect(body.total).to.equal(0) | |
158 | ||
159 | const follows = body.data | |
160 | expect(follows).to.be.an('array') | |
161 | expect(follows.length).to.equal(0) | |
162 | } | |
163 | }) | |
164 | ||
165 | it('Should have 1 followers on server 2 and 3', async function () { | |
166 | for (const server of [ servers[1], servers[2] ]) { | |
167 | const body = await server.followsCommand.getFollowers({ start: 0, count: 1, sort: 'createdAt' }) | |
168 | expect(body.total).to.equal(1) | |
169 | ||
170 | const follows = body.data | |
171 | expect(follows).to.be.an('array') | |
172 | expect(follows.length).to.equal(1) | |
173 | expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port) | |
174 | } | |
175 | }) | |
176 | ||
177 | it('Should search/filter followers on server 2', async function () { | |
178 | const start = 0 | |
179 | const count = 5 | |
180 | const sort = 'createdAt' | |
181 | ||
182 | { | |
183 | const search = servers[0].port + '' | |
184 | ||
185 | { | |
186 | const body = await followsCommands[2].getFollowers({ start, count, sort, search }) | |
187 | expect(body.total).to.equal(1) | |
188 | ||
189 | const follows = body.data | |
190 | expect(follows.length).to.equal(1) | |
191 | expect(follows[0].following.host).to.equal('localhost:' + servers[2].port) | |
192 | } | |
193 | ||
194 | { | |
195 | const body = await followsCommands[2].getFollowers({ start, count, sort, search, state: 'accepted' }) | |
196 | expect(body.total).to.equal(1) | |
197 | expect(body.data).to.have.lengthOf(1) | |
198 | } | |
199 | ||
200 | { | |
201 | const body = await followsCommands[2].getFollowers({ start, count, sort, search, state: 'accepted', actorType: 'Person' }) | |
202 | expect(body.total).to.equal(0) | |
203 | expect(body.data).to.have.lengthOf(0) | |
204 | } | |
205 | ||
206 | { | |
207 | const body = await followsCommands[2].getFollowers({ | |
208 | start, | |
209 | count, | |
210 | sort, | |
211 | search, | |
212 | state: 'accepted', | |
213 | actorType: 'Application' | |
214 | }) | |
215 | expect(body.total).to.equal(1) | |
216 | expect(body.data).to.have.lengthOf(1) | |
217 | } | |
218 | ||
219 | { | |
220 | const body = await followsCommands[2].getFollowers({ start, count, sort, search, state: 'pending' }) | |
221 | expect(body.total).to.equal(0) | |
222 | expect(body.data).to.have.lengthOf(0) | |
223 | } | |
224 | } | |
225 | ||
226 | { | |
227 | const body = await followsCommands[2].getFollowers({ start, count, sort, search: 'bla' }) | |
228 | expect(body.total).to.equal(0) | |
229 | ||
230 | const follows = body.data | |
231 | expect(follows.length).to.equal(0) | |
232 | } | |
233 | }) | |
234 | ||
235 | it('Should have 0 followers on server 1', async function () { | |
236 | const body = await followsCommands[0].getFollowers({ start: 0, count: 5, sort: 'createdAt' }) | |
237 | expect(body.total).to.equal(0) | |
238 | ||
239 | const follows = body.data | |
240 | expect(follows).to.be.an('array') | |
241 | expect(follows.length).to.equal(0) | |
242 | }) | |
243 | ||
244 | it('Should have the correct follows counts', async function () { | |
245 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 2 }) | |
246 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
247 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) | |
248 | ||
249 | // Server 2 and 3 does not know server 1 follow another server (there was not a refresh) | |
250 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
251 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
252 | ||
253 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
254 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) | |
255 | }) | |
256 | ||
257 | it('Should unfollow server 3 on server 1', async function () { | |
258 | this.timeout(5000) | |
259 | ||
260 | await followsCommands[0].unfollow({ target: servers[2] }) | |
261 | ||
262 | await waitJobs(servers) | |
263 | }) | |
264 | ||
265 | it('Should not follow server 3 on server 1 anymore', async function () { | |
266 | const body = await followsCommands[0].getFollowings({ start: 0, count: 2, sort: 'createdAt' }) | |
267 | expect(body.total).to.equal(1) | |
268 | ||
269 | const follows = body.data | |
270 | expect(follows).to.be.an('array') | |
271 | expect(follows.length).to.equal(1) | |
272 | ||
273 | expect(follows[0].following.host).to.equal('localhost:' + servers[1].port) | |
274 | }) | |
275 | ||
276 | it('Should not have server 1 as follower on server 3 anymore', async function () { | |
277 | const body = await followsCommands[2].getFollowers({ start: 0, count: 1, sort: 'createdAt' }) | |
278 | expect(body.total).to.equal(0) | |
279 | ||
280 | const follows = body.data | |
281 | expect(follows).to.be.an('array') | |
282 | expect(follows.length).to.equal(0) | |
283 | }) | |
284 | ||
285 | it('Should have the correct follows counts 2', async function () { | |
286 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
287 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
288 | ||
289 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
290 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
291 | ||
292 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 0 }) | |
293 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 0, following: 0 }) | |
294 | }) | |
295 | ||
296 | it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { | |
297 | this.timeout(60000) | |
298 | ||
299 | await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'server2' }) | |
300 | await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3' }) | |
301 | ||
302 | await waitJobs(servers) | |
303 | ||
304 | let res = await getVideosList(servers[0].url) | |
305 | expect(res.body.total).to.equal(1) | |
306 | expect(res.body.data[0].name).to.equal('server2') | |
307 | ||
308 | res = await getVideosList(servers[1].url) | |
309 | expect(res.body.total).to.equal(1) | |
310 | expect(res.body.data[0].name).to.equal('server2') | |
311 | ||
312 | res = await getVideosList(servers[2].url) | |
313 | expect(res.body.total).to.equal(1) | |
314 | expect(res.body.data[0].name).to.equal('server3') | |
315 | }) | |
316 | ||
317 | describe('Should propagate data on a new following', function () { | |
318 | let video4: Video | |
319 | ||
320 | before(async function () { | |
321 | this.timeout(50000) | |
322 | ||
323 | const video4Attributes = { | |
324 | name: 'server3-4', | |
325 | category: 2, | |
326 | nsfw: true, | |
327 | licence: 6, | |
328 | tags: [ 'tag1', 'tag2', 'tag3' ] | |
329 | } | |
330 | ||
331 | await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-2' }) | |
332 | await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-3' }) | |
333 | await uploadVideo(servers[2].url, servers[2].accessToken, video4Attributes) | |
334 | await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-5' }) | |
335 | await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-6' }) | |
336 | ||
337 | { | |
338 | const user = { username: 'captain', password: 'password' } | |
339 | await createUser({ url: servers[2].url, accessToken: servers[2].accessToken, username: user.username, password: user.password }) | |
340 | const userAccessToken = await userLogin(servers[2], user) | |
341 | ||
342 | const resVideos = await getVideosList(servers[2].url) | |
343 | video4 = resVideos.body.data.find(v => v.name === 'server3-4') | |
344 | ||
345 | { | |
346 | await rateVideo(servers[2].url, servers[2].accessToken, video4.id, 'like') | |
347 | await rateVideo(servers[2].url, userAccessToken, video4.id, 'dislike') | |
348 | } | |
349 | ||
350 | { | |
351 | { | |
352 | const text = 'my super first comment' | |
353 | const res = await addVideoCommentThread(servers[2].url, servers[2].accessToken, video4.id, text) | |
354 | const threadId = res.body.comment.id | |
355 | ||
356 | const text1 = 'my super answer to thread 1' | |
357 | const childCommentRes = await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text1) | |
358 | const childCommentId = childCommentRes.body.comment.id | |
359 | ||
360 | const text2 = 'my super answer to answer of thread 1' | |
361 | await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, childCommentId, text2) | |
362 | ||
363 | const text3 = 'my second answer to thread 1' | |
364 | await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text3) | |
365 | } | |
366 | ||
367 | { | |
368 | const text = 'will be deleted' | |
369 | const res = await addVideoCommentThread(servers[2].url, servers[2].accessToken, video4.id, text) | |
370 | const threadId = res.body.comment.id | |
371 | ||
372 | const text1 = 'answer to deleted' | |
373 | await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text1) | |
374 | ||
375 | const text2 = 'will also be deleted' | |
376 | const childCommentRes = await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text2) | |
377 | const childCommentId = childCommentRes.body.comment.id | |
378 | ||
379 | const text3 = 'my second answer to deleted' | |
380 | await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, childCommentId, text3) | |
381 | ||
382 | await deleteVideoComment(servers[2].url, servers[2].accessToken, video4.id, threadId) | |
383 | await deleteVideoComment(servers[2].url, servers[2].accessToken, video4.id, childCommentId) | |
384 | } | |
385 | } | |
386 | ||
387 | { | |
388 | await createVideoCaption({ | |
389 | url: servers[2].url, | |
390 | accessToken: servers[2].accessToken, | |
391 | language: 'ar', | |
392 | videoId: video4.id, | |
393 | fixture: 'subtitle-good2.vtt' | |
394 | }) | |
395 | } | |
396 | } | |
397 | ||
398 | await waitJobs(servers) | |
399 | ||
400 | // Server 1 follows server 3 | |
401 | await followsCommands[0].follow({ targets: [ servers[2].url ] }) | |
402 | ||
403 | await waitJobs(servers) | |
404 | }) | |
405 | ||
406 | it('Should have the correct follows counts 3', async function () { | |
407 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 2 }) | |
408 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
409 | await expectAccountFollows({ server: servers[0], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) | |
410 | ||
411 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
412 | await expectAccountFollows({ server: servers[1], handle: 'peertube@localhost:' + servers[1].port, followers: 1, following: 0 }) | |
413 | ||
414 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[0].port, followers: 0, following: 1 }) | |
415 | await expectAccountFollows({ server: servers[2], handle: 'peertube@localhost:' + servers[2].port, followers: 1, following: 0 }) | |
416 | }) | |
417 | ||
418 | it('Should have propagated videos', async function () { | |
419 | const res = await getVideosList(servers[0].url) | |
420 | expect(res.body.total).to.equal(7) | |
421 | ||
422 | const video2 = res.body.data.find(v => v.name === 'server3-2') | |
423 | video4 = res.body.data.find(v => v.name === 'server3-4') | |
424 | const video6 = res.body.data.find(v => v.name === 'server3-6') | |
425 | ||
426 | expect(video2).to.not.be.undefined | |
427 | expect(video4).to.not.be.undefined | |
428 | expect(video6).to.not.be.undefined | |
429 | ||
430 | const isLocal = false | |
431 | const checkAttributes = { | |
432 | name: 'server3-4', | |
433 | category: 2, | |
434 | licence: 6, | |
435 | language: 'zh', | |
436 | nsfw: true, | |
437 | description: 'my super description', | |
438 | support: 'my super support text', | |
439 | account: { | |
440 | name: 'root', | |
441 | host: 'localhost:' + servers[2].port | |
442 | }, | |
443 | isLocal, | |
444 | commentsEnabled: true, | |
445 | downloadEnabled: true, | |
446 | duration: 5, | |
447 | tags: [ 'tag1', 'tag2', 'tag3' ], | |
448 | privacy: VideoPrivacy.PUBLIC, | |
449 | likes: 1, | |
450 | dislikes: 1, | |
451 | channel: { | |
452 | displayName: 'Main root channel', | |
453 | name: 'root_channel', | |
454 | description: '', | |
455 | isLocal | |
456 | }, | |
457 | fixture: 'video_short.webm', | |
458 | files: [ | |
459 | { | |
460 | resolution: 720, | |
461 | size: 218910 | |
462 | } | |
463 | ] | |
464 | } | |
465 | await completeVideoCheck(servers[0].url, video4, checkAttributes) | |
466 | }) | |
467 | ||
468 | it('Should have propagated comments', async function () { | |
469 | const res1 = await getVideoCommentThreads(servers[0].url, video4.id, 0, 5, 'createdAt') | |
470 | ||
471 | expect(res1.body.total).to.equal(2) | |
472 | expect(res1.body.data).to.be.an('array') | |
473 | expect(res1.body.data).to.have.lengthOf(2) | |
474 | ||
475 | { | |
476 | const comment: VideoComment = res1.body.data[0] | |
477 | expect(comment.inReplyToCommentId).to.be.null | |
478 | expect(comment.text).equal('my super first comment') | |
479 | expect(comment.videoId).to.equal(video4.id) | |
480 | expect(comment.id).to.equal(comment.threadId) | |
481 | expect(comment.account.name).to.equal('root') | |
482 | expect(comment.account.host).to.equal('localhost:' + servers[2].port) | |
483 | expect(comment.totalReplies).to.equal(3) | |
484 | expect(dateIsValid(comment.createdAt as string)).to.be.true | |
485 | expect(dateIsValid(comment.updatedAt as string)).to.be.true | |
486 | ||
487 | const threadId = comment.threadId | |
488 | ||
489 | const res2 = await getVideoThreadComments(servers[0].url, video4.id, threadId) | |
490 | ||
491 | const tree: VideoCommentThreadTree = res2.body | |
492 | expect(tree.comment.text).equal('my super first comment') | |
493 | expect(tree.children).to.have.lengthOf(2) | |
494 | ||
495 | const firstChild = tree.children[0] | |
496 | expect(firstChild.comment.text).to.equal('my super answer to thread 1') | |
497 | expect(firstChild.children).to.have.lengthOf(1) | |
498 | ||
499 | const childOfFirstChild = firstChild.children[0] | |
500 | expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') | |
501 | expect(childOfFirstChild.children).to.have.lengthOf(0) | |
502 | ||
503 | const secondChild = tree.children[1] | |
504 | expect(secondChild.comment.text).to.equal('my second answer to thread 1') | |
505 | expect(secondChild.children).to.have.lengthOf(0) | |
506 | } | |
507 | ||
508 | { | |
509 | const deletedComment: VideoComment = res1.body.data[1] | |
510 | expect(deletedComment).to.not.be.undefined | |
511 | expect(deletedComment.isDeleted).to.be.true | |
512 | expect(deletedComment.deletedAt).to.not.be.null | |
513 | expect(deletedComment.text).to.equal('') | |
514 | expect(deletedComment.inReplyToCommentId).to.be.null | |
515 | expect(deletedComment.account).to.be.null | |
516 | expect(deletedComment.totalReplies).to.equal(2) | |
517 | expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true | |
518 | ||
519 | const res2 = await getVideoThreadComments(servers[0].url, video4.id, deletedComment.threadId) | |
520 | ||
521 | const tree: VideoCommentThreadTree = res2.body | |
522 | const [ commentRoot, deletedChildRoot ] = tree.children | |
523 | ||
524 | expect(deletedChildRoot).to.not.be.undefined | |
525 | expect(deletedChildRoot.comment.isDeleted).to.be.true | |
526 | expect(deletedChildRoot.comment.deletedAt).to.not.be.null | |
527 | expect(deletedChildRoot.comment.text).to.equal('') | |
528 | expect(deletedChildRoot.comment.inReplyToCommentId).to.equal(deletedComment.id) | |
529 | expect(deletedChildRoot.comment.account).to.be.null | |
530 | expect(deletedChildRoot.children).to.have.lengthOf(1) | |
531 | ||
532 | const answerToDeletedChild = deletedChildRoot.children[0] | |
533 | expect(answerToDeletedChild.comment).to.not.be.undefined | |
534 | expect(answerToDeletedChild.comment.inReplyToCommentId).to.equal(deletedChildRoot.comment.id) | |
535 | expect(answerToDeletedChild.comment.text).to.equal('my second answer to deleted') | |
536 | expect(answerToDeletedChild.comment.account.name).to.equal('root') | |
537 | ||
538 | expect(commentRoot.comment).to.not.be.undefined | |
539 | expect(commentRoot.comment.inReplyToCommentId).to.equal(deletedComment.id) | |
540 | expect(commentRoot.comment.text).to.equal('answer to deleted') | |
541 | expect(commentRoot.comment.account.name).to.equal('root') | |
542 | } | |
543 | }) | |
544 | ||
545 | it('Should have propagated captions', async function () { | |
546 | const res = await listVideoCaptions(servers[0].url, video4.id) | |
547 | expect(res.body.total).to.equal(1) | |
548 | expect(res.body.data).to.have.lengthOf(1) | |
549 | ||
550 | const caption1: VideoCaption = res.body.data[0] | |
551 | expect(caption1.language.id).to.equal('ar') | |
552 | expect(caption1.language.label).to.equal('Arabic') | |
553 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/.+-ar.vtt$')) | |
554 | await testCaptionFile(servers[0].url, caption1.captionPath, 'Subtitle good 2.') | |
555 | }) | |
556 | ||
557 | it('Should unfollow server 3 on server 1 and does not list server 3 videos', async function () { | |
558 | this.timeout(5000) | |
559 | ||
560 | await followsCommands[0].unfollow({ target: servers[2] }) | |
561 | ||
562 | await waitJobs(servers) | |
563 | ||
564 | const res = await getVideosList(servers[0].url) | |
565 | expect(res.body.total).to.equal(1) | |
566 | }) | |
567 | ||
568 | }) | |
569 | ||
570 | after(async function () { | |
571 | await cleanupTests(servers) | |
572 | }) | |
573 | }) |