aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/video-description.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/video-description.ts')
-rw-r--r--server/tests/api/video-description.ts37
1 files changed, 18 insertions, 19 deletions
diff --git a/server/tests/api/video-description.ts b/server/tests/api/video-description.ts
index 43d99e9e6..187fd21f2 100644
--- a/server/tests/api/video-description.ts
+++ b/server/tests/api/video-description.ts
@@ -1,22 +1,21 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import 'mocha'
4import * as chai from 'chai' 3import * as chai from 'chai'
5 4import 'mocha'
6import { 5import {
7 flushAndRunMultipleServers, 6 flushAndRunMultipleServers,
8 flushTests, 7 flushTests,
9 getVideo, 8 getVideo,
9 getVideoDescription,
10 getVideosList, 10 getVideosList,
11 killallServers, 11 killallServers,
12 makeFriends,
13 ServerInfo, 12 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
14 updateVideo,
15 uploadVideo, 15 uploadVideo,
16 wait, 16 wait
17 getVideoDescription,
18 updateVideo
19} from '../utils' 17} from '../utils'
18import { doubleFollow } from '../utils/follows'
20 19
21const expect = chai.expect 20const expect = chai.expect
22 21
@@ -24,10 +23,10 @@ describe('Test video description', function () {
24 let servers: ServerInfo[] = [] 23 let servers: ServerInfo[] = []
25 let videoUUID = '' 24 let videoUUID = ''
26 let videoId: number 25 let videoId: number
27 let longDescription = 'my super description for pod 1'.repeat(50) 26 let longDescription = 'my super description for server 1'.repeat(50)
28 27
29 before(async function () { 28 before(async function () {
30 this.timeout(10000) 29 this.timeout(30000)
31 30
32 // Run servers 31 // Run servers
33 servers = await flushAndRunMultipleServers(2) 32 servers = await flushAndRunMultipleServers(2)
@@ -35,19 +34,19 @@ describe('Test video description', function () {
35 // Get the access tokens 34 // Get the access tokens
36 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
37 36
38 // Pod 1 makes friend with pod 2 37 // Server 1 and server 2 follow each other
39 await makeFriends(servers[0].url, servers[0].accessToken) 38 await doubleFollow(servers[0], servers[1])
40 }) 39 })
41 40
42 it('Should upload video with long description', async function () { 41 it('Should upload video with long description', async function () {
43 this.timeout(15000) 42 this.timeout(30000)
44 43
45 const attributes = { 44 const attributes = {
46 description: longDescription 45 description: longDescription
47 } 46 }
48 await uploadVideo(servers[0].url, servers[0].accessToken, attributes) 47 await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
49 48
50 await wait(11000) 49 await wait(25000)
51 50
52 const res = await getVideosList(servers[0].url) 51 const res = await getVideosList(servers[0].url)
53 52
@@ -55,20 +54,20 @@ describe('Test video description', function () {
55 videoUUID = res.body.data[0].uuid 54 videoUUID = res.body.data[0].uuid
56 }) 55 })
57 56
58 it('Should have a truncated description on each pod', async function () { 57 it('Should have a truncated description on each server', async function () {
59 for (const server of servers) { 58 for (const server of servers) {
60 const res = await getVideo(server.url, videoUUID) 59 const res = await getVideo(server.url, videoUUID)
61 const video = res.body 60 const video = res.body
62 61
63 // 30 characters * 6 -> 240 characters 62 // 30 characters * 6 -> 240 characters
64 const truncatedDescription = 'my super description for pod 1'.repeat(8) + 63 const truncatedDescription = 'my super description for server 1'.repeat(7) +
65 'my supe...' 64 'my super descrip...'
66 65
67 expect(video.description).to.equal(truncatedDescription) 66 expect(video.description).to.equal(truncatedDescription)
68 } 67 }
69 }) 68 })
70 69
71 it('Should fetch long description on each pod', async function () { 70 it('Should fetch long description on each server', async function () {
72 for (const server of servers) { 71 for (const server of servers) {
73 const res = await getVideo(server.url, videoUUID) 72 const res = await getVideo(server.url, videoUUID)
74 const video = res.body 73 const video = res.body
@@ -79,17 +78,17 @@ describe('Test video description', function () {
79 }) 78 })
80 79
81 it('Should update with a short description', async function () { 80 it('Should update with a short description', async function () {
82 this.timeout(15000) 81 this.timeout(30000)
83 82
84 const attributes = { 83 const attributes = {
85 description: 'short description' 84 description: 'short description'
86 } 85 }
87 await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes) 86 await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
88 87
89 await wait(11000) 88 await wait(25000)
90 }) 89 })
91 90
92 it('Should have a small description on each pod', async function () { 91 it('Should have a small description on each server', async function () {
93 for (const server of servers) { 92 for (const server of servers) {
94 const res = await getVideo(server.url, videoUUID) 93 const res = await getVideo(server.url, videoUUID)
95 const video = res.body 94 const video = res.body