X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-description.ts;h=1f3d4adbb5fb57d5e9460566b9e980dc072ffc99;hb=33b91e53d21fba295ecf516b717fb36e91990771;hp=ce45eac80a16bbe4dd3de3b24a5aef497e100cdb;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index ce45eac80..1f3d4adbb 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts @@ -1,17 +1,25 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' - -const expect = chai.expect +import { expect } from 'chai' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' describe('Test video description', function () { let servers: PeerTubeServer[] = [] let videoUUID = '' let videoId: number + const longDescription = 'my super description for server 1'.repeat(50) + // 30 characters * 6 -> 240 characters + const truncatedDescription = 'my super description for server 1'.repeat(7) + 'my super descrip...' + before(async function () { this.timeout(40000) @@ -26,7 +34,7 @@ describe('Test video description', function () { }) it('Should upload video with long description', async function () { - this.timeout(10000) + this.timeout(30000) const attributes = { description: longDescription @@ -41,15 +49,22 @@ describe('Test video description', function () { videoUUID = data[0].uuid }) - it('Should have a truncated description on each server', async function () { + it('Should have a truncated description on each server when listing videos', async function () { for (const server of servers) { - const video = await server.videos.get({ id: videoUUID }) - - // 30 characters * 6 -> 240 characters - const truncatedDescription = 'my super description for server 1'.repeat(7) + - 'my super descrip...' + const { data } = await server.videos.list() + const video = data.find(v => v.uuid === videoUUID) expect(video.description).to.equal(truncatedDescription) + expect(video.truncatedDescription).to.equal(truncatedDescription) + } + }) + + it('Should not have a truncated description on each server when getting videos', async function () { + for (const server of servers) { + const video = await server.videos.get({ id: videoUUID }) + + expect(video.description).to.equal(longDescription) + expect(video.truncatedDescription).to.equal(truncatedDescription) } }) @@ -63,8 +78,6 @@ describe('Test video description', function () { }) it('Should update with a short description', async function () { - this.timeout(10000) - const attributes = { description: 'short description' }