1 /* tslint:disable:no-unused-expression */
3 import * as chai from 'chai'
6 flushAndRunMultipleServers,
13 setAccessTokensToServers,
18 import { doubleFollow } from '../utils/follows'
20 const expect = chai.expect
22 describe('Test video description', function () {
23 let servers: ServerInfo[] = []
26 let longDescription = 'my super description for server 1'.repeat(50)
28 before(async function () {
32 servers = await flushAndRunMultipleServers(2)
34 // Get the access tokens
35 await setAccessTokensToServers(servers)
37 // Server 1 and server 2 follow each other
38 await doubleFollow(servers[0], servers[1])
41 it('Should upload video with long description', async function () {
45 description: longDescription
47 await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
51 const res = await getVideosList(servers[0].url)
53 videoId = res.body.data[0].id
54 videoUUID = res.body.data[0].uuid
57 it('Should have a truncated description on each server', async function () {
58 for (const server of servers) {
59 const res = await getVideo(server.url, videoUUID)
60 const video = res.body
62 // 30 characters * 6 -> 240 characters
63 const truncatedDescription = 'my super description for server 1'.repeat(7) +
66 expect(video.description).to.equal(truncatedDescription)
70 it('Should fetch long description on each server', async function () {
71 for (const server of servers) {
72 const res = await getVideo(server.url, videoUUID)
73 const video = res.body
75 const res2 = await getVideoDescription(server.url, video.descriptionPath)
76 expect(res2.body.description).to.equal(longDescription)
80 it('Should update with a short description', async function () {
84 description: 'short description'
86 await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
91 it('Should have a small description on each server', async function () {
92 for (const server of servers) {
93 const res = await getVideo(server.url, videoUUID)
94 const video = res.body
96 expect(video.description).to.equal('short description')
98 const res2 = await getVideoDescription(server.url, video.descriptionPath)
99 expect(res2.body.description).to.equal('short description')
103 after(async function () {
104 killallServers(servers)
106 // Keep the logs if the test failed