1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import { expect } from 'chai'
9 setAccessTokensToServers,
11 } from '@shared/server-commands'
13 describe('Test video description', function () {
14 let servers: PeerTubeServer[] = []
17 const longDescription = 'my super description for server 1'.repeat(50)
19 before(async function () {
23 servers = await createMultipleServers(2)
25 // Get the access tokens
26 await setAccessTokensToServers(servers)
28 // Server 1 and server 2 follow each other
29 await doubleFollow(servers[0], servers[1])
32 it('Should upload video with long description', async function () {
36 description: longDescription
38 await servers[0].videos.upload({ attributes })
40 await waitJobs(servers)
42 const { data } = await servers[0].videos.list()
45 videoUUID = data[0].uuid
48 it('Should have a truncated description on each server', async function () {
49 for (const server of servers) {
50 const video = await server.videos.get({ id: videoUUID })
52 // 30 characters * 6 -> 240 characters
53 const truncatedDescription = 'my super description for server 1'.repeat(7) +
56 expect(video.description).to.equal(truncatedDescription)
60 it('Should fetch long description on each server', async function () {
61 for (const server of servers) {
62 const video = await server.videos.get({ id: videoUUID })
64 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
65 expect(description).to.equal(longDescription)
69 it('Should update with a short description', async function () {
73 description: 'short description'
75 await servers[0].videos.update({ id: videoId, attributes })
77 await waitJobs(servers)
80 it('Should have a small description on each server', async function () {
81 for (const server of servers) {
82 const video = await server.videos.get({ id: videoUUID })
84 expect(video.description).to.equal('short description')
86 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
87 expect(description).to.equal('short description')
91 after(async function () {
92 await cleanupTests(servers)