X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideo-description.ts;h=187fd21f2344a131285bf12111916f0b373e40aa;hb=9a27cdc27c900feaae5f6db4315c4ccdfc0c4493;hp=f04c5f1f65610ef752645ec4340fb5a0d0cee14b;hpb=9567011bf01f36c7f796ac1e0f1fb12c71635e53;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/video-description.ts b/server/tests/api/video-description.ts index f04c5f1f6..187fd21f2 100644 --- a/server/tests/api/video-description.ts +++ b/server/tests/api/video-description.ts @@ -1,31 +1,32 @@ /* tslint:disable:no-unused-expression */ -import 'mocha' import * as chai from 'chai' - +import 'mocha' import { flushAndRunMultipleServers, flushTests, getVideo, + getVideoDescription, getVideosList, killallServers, - makeFriends, ServerInfo, setAccessTokensToServers, + updateVideo, uploadVideo, - wait, - getVideoDescription + wait } from '../utils' +import { doubleFollow } from '../utils/follows' const expect = chai.expect describe('Test video description', function () { let servers: ServerInfo[] = [] let videoUUID = '' - let longDescription = 'my super description for pod 1'.repeat(50) + let videoId: number + let longDescription = 'my super description for server 1'.repeat(50) before(async function () { - this.timeout(10000) + this.timeout(30000) // Run servers servers = await flushAndRunMultipleServers(2) @@ -33,39 +34,40 @@ describe('Test video description', function () { // Get the access tokens await setAccessTokensToServers(servers) - // Pod 1 makes friend with pod 2 - await makeFriends(servers[0].url, servers[0].accessToken) + // Server 1 and server 2 follow each other + await doubleFollow(servers[0], servers[1]) }) it('Should upload video with long description', async function () { - this.timeout(15000) + this.timeout(30000) const attributes = { description: longDescription } await uploadVideo(servers[0].url, servers[0].accessToken, attributes) - await wait(11000) + await wait(25000) const res = await getVideosList(servers[0].url) + videoId = res.body.data[0].id videoUUID = res.body.data[0].uuid }) - it('Should have a truncated description on each pod', async function () { + it('Should have a truncated description on each server', async function () { for (const server of servers) { const res = await getVideo(server.url, videoUUID) const video = res.body // 30 characters * 6 -> 240 characters - const truncatedDescription = 'my super description for pod 1'.repeat(8) + - 'my supe...' + const truncatedDescription = 'my super description for server 1'.repeat(7) + + 'my super descrip...' expect(video.description).to.equal(truncatedDescription) } }) - it('Should fetch long description on each pod', async function () { + it('Should fetch long description on each server', async function () { for (const server of servers) { const res = await getVideo(server.url, videoUUID) const video = res.body @@ -75,6 +77,29 @@ describe('Test video description', function () { } }) + it('Should update with a short description', async function () { + this.timeout(30000) + + const attributes = { + description: 'short description' + } + await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes) + + await wait(25000) + }) + + it('Should have a small description on each server', async function () { + for (const server of servers) { + const res = await getVideo(server.url, videoUUID) + const video = res.body + + expect(video.description).to.equal('short description') + + const res2 = await getVideoDescription(server.url, video.descriptionPath) + expect(res2.body.description).to.equal('short description') + } + }) + after(async function () { killallServers(servers)