1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
9 setAccessTokensToServers,
11 } from '@shared/server-commands'
13 const expect = chai.expect
15 describe('Test video description', function () {
16 let servers: PeerTubeServer[] = []
19 const longDescription = 'my super description for server 1'.repeat(50)
21 before(async function () {
25 servers = await createMultipleServers(2)
27 // Get the access tokens
28 await setAccessTokensToServers(servers)
30 // Server 1 and server 2 follow each other
31 await doubleFollow(servers[0], servers[1])
34 it('Should upload video with long description', async function () {
38 description: longDescription
40 await servers[0].videos.upload({ attributes })
42 await waitJobs(servers)
44 const { data } = await servers[0].videos.list()
47 videoUUID = data[0].uuid
50 it('Should have a truncated description on each server', async function () {
51 for (const server of servers) {
52 const video = await server.videos.get({ id: videoUUID })
54 // 30 characters * 6 -> 240 characters
55 const truncatedDescription = 'my super description for server 1'.repeat(7) +
58 expect(video.description).to.equal(truncatedDescription)
62 it('Should fetch long description on each server', async function () {
63 for (const server of servers) {
64 const video = await server.videos.get({ id: videoUUID })
66 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
67 expect(description).to.equal(longDescription)
71 it('Should update with a short description', async function () {
75 description: 'short description'
77 await servers[0].videos.update({ id: videoId, attributes })
79 await waitJobs(servers)
82 it('Should have a small description on each server', async function () {
83 for (const server of servers) {
84 const video = await server.videos.get({ id: videoUUID })
86 expect(video.description).to.equal('short description')
88 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
89 expect(description).to.equal('short description')
93 after(async function () {
94 await cleanupTests(servers)