X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftests%2Fapi%2Fserver%2Ffollows.ts;h=2a5fff82b046bc4eb42c635dd10e3e737f9cb86f;hb=HEAD;hp=748f4cd35689ffb8dc7c81ed204ead0aa3c411fc;hpb=06aad80165d09a8863ab8103149a8ff518b10641;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 748f4cd35..2a5fff82b 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -1,28 +1,15 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' -import { - cleanupTests, - createMultipleServers, - dateIsValid, - expectAccountFollows, - expectChannelsFollows, - PeerTubeServer, - setAccessTokensToServers, - testCaptionFile, - waitJobs -} from '@shared/extra-utils' -import { VideoCreateResult, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' - -const expect = chai.expect +import { expect } from 'chai' +import { completeVideoCheck, dateIsValid, expectAccountFollows, expectChannelsFollows, testCaptionFile } from '@server/tests/shared' +import { Video, VideoPrivacy } from '@shared/models' +import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' describe('Test follows', function () { let servers: PeerTubeServer[] = [] before(async function () { - this.timeout(30000) + this.timeout(120000) servers = await createMultipleServers(3) @@ -101,7 +88,7 @@ describe('Test follows', function () { const follows = body.data expect(follows).to.be.an('array') expect(follows).to.have.lengthOf(1) - expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port) + expect(follows[0].follower.host).to.equal(servers[0].host) }) it('Should have 0 followers on server 1 and 2', async function () { @@ -292,7 +279,7 @@ describe('Test follows', function () { }) it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { - this.timeout(60000) + this.timeout(160000) await servers[1].videos.upload({ attributes: { name: 'server2' } }) await servers[2].videos.upload({ attributes: { name: 'server3' } }) @@ -370,10 +357,10 @@ describe('Test follows', function () { }) describe('Should propagate data on a new server follow', function () { - let video4: VideoCreateResult + let video4: Video before(async function () { - this.timeout(50000) + this.timeout(120000) const video4Attributes = { name: 'server3-4', @@ -385,19 +372,19 @@ describe('Test follows', function () { await servers[2].videos.upload({ attributes: { name: 'server3-2' } }) await servers[2].videos.upload({ attributes: { name: 'server3-3' } }) - video4 = await servers[2].videos.upload({ attributes: video4Attributes }) + const video4CreateResult = await servers[2].videos.upload({ attributes: video4Attributes }) await servers[2].videos.upload({ attributes: { name: 'server3-5' } }) await servers[2].videos.upload({ attributes: { name: 'server3-6' } }) { const userAccessToken = await servers[2].users.generateUserAndToken('captain') - await servers[2].videos.rate({ id: video4.id, rating: 'like' }) - await servers[2].videos.rate({ token: userAccessToken, id: video4.id, rating: 'dislike' }) + await servers[2].videos.rate({ id: video4CreateResult.id, rating: 'like' }) + await servers[2].videos.rate({ token: userAccessToken, id: video4CreateResult.id, rating: 'dislike' }) } { - await servers[2].comments.createThread({ videoId: video4.id, text: 'my super first comment' }) + await servers[2].comments.createThread({ videoId: video4CreateResult.id, text: 'my super first comment' }) await servers[2].comments.addReplyToLastThread({ text: 'my super answer to thread 1' }) await servers[2].comments.addReplyToLastReply({ text: 'my super answer to answer of thread 1' }) @@ -405,20 +392,20 @@ describe('Test follows', function () { } { - const { id: threadId } = await servers[2].comments.createThread({ videoId: video4.id, text: 'will be deleted' }) + const { id: threadId } = await servers[2].comments.createThread({ videoId: video4CreateResult.id, text: 'will be deleted' }) await servers[2].comments.addReplyToLastThread({ text: 'answer to deleted' }) const { id: replyId } = await servers[2].comments.addReplyToLastThread({ text: 'will also be deleted' }) await servers[2].comments.addReplyToLastReply({ text: 'my second answer to deleted' }) - await servers[2].comments.delete({ videoId: video4.id, commentId: threadId }) - await servers[2].comments.delete({ videoId: video4.id, commentId: replyId }) + await servers[2].comments.delete({ videoId: video4CreateResult.id, commentId: threadId }) + await servers[2].comments.delete({ videoId: video4CreateResult.id, commentId: replyId }) } await servers[2].captions.add({ language: 'ar', - videoId: video4.id, + videoId: video4CreateResult.id, fixture: 'subtitle-good2.vtt' }) @@ -492,7 +479,12 @@ describe('Test follows', function () { } ] } - await completeVideoCheck(servers[0], video4, checkAttributes) + await completeVideoCheck({ + server: servers[0], + originServer: servers[2], + videoUUID: video4.uuid, + attributes: checkAttributes + }) }) it('Should have propagated comments', async function () {