1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import * as chai from 'chai'
10 setAccessTokensToServers,
12 } from '@shared/server-commands'
14 const expect = chai.expect
16 describe('Test video description', function () {
17 let servers: PeerTubeServer[] = []
20 const longDescription = 'my super description for server 1'.repeat(50)
22 before(async function () {
26 servers = await createMultipleServers(2)
28 // Get the access tokens
29 await setAccessTokensToServers(servers)
31 // Server 1 and server 2 follow each other
32 await doubleFollow(servers[0], servers[1])
35 it('Should upload video with long description', async function () {
39 description: longDescription
41 await servers[0].videos.upload({ attributes })
43 await waitJobs(servers)
45 const { data } = await servers[0].videos.list()
48 videoUUID = data[0].uuid
51 it('Should have a truncated description on each server', async function () {
52 for (const server of servers) {
53 const video = await server.videos.get({ id: videoUUID })
55 // 30 characters * 6 -> 240 characters
56 const truncatedDescription = 'my super description for server 1'.repeat(7) +
59 expect(video.description).to.equal(truncatedDescription)
63 it('Should fetch long description on each server', async function () {
64 for (const server of servers) {
65 const video = await server.videos.get({ id: videoUUID })
67 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
68 expect(description).to.equal(longDescription)
72 it('Should update with a short description', async function () {
76 description: 'short description'
78 await servers[0].videos.update({ id: videoId, attributes })
80 await waitJobs(servers)
83 it('Should have a small description on each server', async function () {
84 for (const server of servers) {
85 const video = await server.videos.get({ id: videoUUID })
87 expect(video.description).to.equal('short description')
89 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
90 expect(description).to.equal('short description')
94 after(async function () {
95 await cleanupTests(servers)