1 /* tslint:disable:no-unused-expression */
4 import * as chai from 'chai'
7 flushAndRunMultipleServers,
14 setAccessTokensToServers,
21 const expect = chai.expect
23 describe('Test video description', function () {
24 let servers: ServerInfo[] = []
27 let longDescription = 'my super description for pod 1'.repeat(50)
29 before(async function () {
33 servers = await flushAndRunMultipleServers(2)
35 // Get the access tokens
36 await setAccessTokensToServers(servers)
38 // Pod 1 makes friend with pod 2
39 await makeFriends(servers[0].url, servers[0].accessToken)
42 it('Should upload video with long description', async function () {
46 description: longDescription
48 await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
52 const res = await getVideosList(servers[0].url)
54 videoId = res.body.data[0].id
55 videoUUID = res.body.data[0].uuid
58 it('Should have a truncated description on each pod', async function () {
59 for (const server of servers) {
60 const res = await getVideo(server.url, videoUUID)
61 const video = res.body
63 // 30 characters * 6 -> 240 characters
64 const truncatedDescription = 'my super description for pod 1'.repeat(8) +
67 expect(video.description).to.equal(truncatedDescription)
71 it('Should fetch long description on each pod', async function () {
72 for (const server of servers) {
73 const res = await getVideo(server.url, videoUUID)
74 const video = res.body
76 const res2 = await getVideoDescription(server.url, video.descriptionPath)
77 expect(res2.body.description).to.equal(longDescription)
81 it('Should update with a short description', async function () {
85 description: 'short description'
87 await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
92 it('Should have a small description on each pod', async function () {
93 for (const server of servers) {
94 const res = await getVideo(server.url, videoUUID)
95 const video = res.body
97 expect(video.description).to.equal('short description')
99 const res2 = await getVideoDescription(server.url, video.descriptionPath)
100 expect(res2.body.description).to.equal('short description')
104 after(async function () {
105 killallServers(servers)
107 // Keep the logs if the test failed