1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
7 flushAndRunMultipleServers,
12 setAccessTokensToServers,
15 } from '../../../../shared/extra-utils/index'
16 import { doubleFollow } from '../../../../shared/extra-utils/server/follows'
17 import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
19 const expect = chai.expect
21 describe('Test video description', function () {
22 let servers: ServerInfo[] = []
25 const longDescription = 'my super description for server 1'.repeat(50)
27 before(async function () {
31 servers = await flushAndRunMultipleServers(2)
33 // Get the access tokens
34 await setAccessTokensToServers(servers)
36 // Server 1 and server 2 follow each other
37 await doubleFollow(servers[0], servers[1])
40 it('Should upload video with long description', async function () {
44 description: longDescription
46 await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
48 await waitJobs(servers)
50 const res = await getVideosList(servers[0].url)
52 videoId = res.body.data[0].id
53 videoUUID = res.body.data[0].uuid
56 it('Should have a truncated description on each server', async function () {
57 for (const server of servers) {
58 const res = await getVideo(server.url, videoUUID)
59 const video = res.body
61 // 30 characters * 6 -> 240 characters
62 const truncatedDescription = 'my super description for server 1'.repeat(7) +
65 expect(video.description).to.equal(truncatedDescription)
69 it('Should fetch long description on each server', async function () {
70 for (const server of servers) {
71 const res = await getVideo(server.url, videoUUID)
72 const video = res.body
74 const res2 = await getVideoDescription(server.url, video.descriptionPath)
75 expect(res2.body.description).to.equal(longDescription)
79 it('Should update with a short description', async function () {
83 description: 'short description'
85 await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
87 await waitJobs(servers)
90 it('Should have a small description on each server', async function () {
91 for (const server of servers) {
92 const res = await getVideo(server.url, videoUUID)
93 const video = res.body
95 expect(video.description).to.equal('short description')
97 const res2 = await getVideoDescription(server.url, video.descriptionPath)
98 expect(res2.body.description).to.equal('short description')
102 after(async function () {
103 await cleanupTests(servers)