From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- server/tests/api/redundancy/manage-redundancy.ts | 44 ++++++++++++------------ server/tests/api/redundancy/redundancy.ts | 44 ++++++++++++------------ 2 files changed, 44 insertions(+), 44 deletions(-) (limited to 'server/tests/api/redundancy') diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts index 6a8937f24..4253124c8 100644 --- a/server/tests/api/redundancy/manage-redundancy.ts +++ b/server/tests/api/redundancy/manage-redundancy.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import * as chai from 'chai' import 'mocha' @@ -56,20 +56,20 @@ describe('Test manage videos redundancy', function () { await setAccessTokensToServers(servers) { - const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' }) + const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' }) video1Server2UUID = res.body.video.uuid } { - const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' }) + const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' }) video2Server2UUID = res.body.video.uuid } await waitJobs(servers) // Server 1 and server 2 follow each other - await doubleFollow(servers[ 0 ], servers[ 1 ]) - await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true) + await doubleFollow(servers[0], servers[1]) + await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true) await waitJobs(servers) }) @@ -195,8 +195,8 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 1 server 2') - expect(videos[ 1 ].name).to.equal('video 2 server 2') + expect(videos[0].name).to.equal('video 1 server 2') + expect(videos[1].name).to.equal('video 2 server 2') } { @@ -210,8 +210,8 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 2 server 2') - expect(videos[ 1 ].name).to.equal('video 1 server 2') + expect(videos[0].name).to.equal('video 2 server 2') + expect(videos[1].name).to.equal('video 1 server 2') } { @@ -225,14 +225,14 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 1 server 2') + expect(videos[0].name).to.equal('video 1 server 2') } }) it('Should manually add a redundancy and list it', async function () { this.timeout(120000) - const uuid = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuid + const uuid = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuid await waitJobs(servers) const videoId = await getLocalIdByUUID(servers[0].url, uuid) @@ -257,9 +257,9 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 3 server 2') + expect(videos[0].name).to.equal('video 3 server 2') - const video = videos[ 0 ] + const video = videos[0] expect(video.redundancies.files).to.have.lengthOf(4) expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) @@ -286,9 +286,9 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 3 server 2') + expect(videos[0].name).to.equal('video 3 server 2') - const video = videos[ 0 ] + const video = videos[0] expect(video.redundancies.files).to.have.lengthOf(4) expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) @@ -308,8 +308,8 @@ describe('Test manage videos redundancy', function () { for (const redundancyId of redundanciesToRemove) { await removeVideoRedundancy({ - url: servers[ 0 ].url, - accessToken: servers[ 0 ].accessToken, + url: servers[0].url, + accessToken: servers[0].accessToken, redundancyId }) } @@ -327,10 +327,10 @@ describe('Test manage videos redundancy', function () { const videos = res.body.data expect(videos).to.have.lengthOf(2) - expect(videos[ 0 ].name).to.equal('video 2 server 2') + expect(videos[0].name).to.equal('video 2 server 2') redundanciesToRemove = [] - const video = videos[ 0 ] + const video = videos[0] expect(video.redundancies.files).to.have.lengthOf(4) expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1) @@ -346,8 +346,8 @@ describe('Test manage videos redundancy', function () { { for (const redundancyId of redundanciesToRemove) { await removeVideoRedundancy({ - url: servers[ 0 ].url, - accessToken: servers[ 0 ].accessToken, + url: servers[0].url, + accessToken: servers[0].accessToken, redundancyId }) } @@ -362,7 +362,7 @@ describe('Test manage videos redundancy', function () { }) const videos = res.body.data - expect(videos[ 0 ].name).to.equal('video 1 server 2') + expect(videos[0].name).to.equal('video 1 server 2') expect(videos).to.have.lengthOf(1) } }) diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index f5bf130d5..c5037a541 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import * as chai from 'chai' import 'mocha' @@ -92,21 +92,21 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, add await setAccessTokensToServers(servers) { - const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' }) + const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' }) video1Server2UUID = res.body.video.uuid video1Server2Id = res.body.video.id - await viewVideo(servers[ 1 ].url, video1Server2UUID) + await viewVideo(servers[1].url, video1Server2UUID) } await waitJobs(servers) // Server 1 and server 2 follow each other - await doubleFollow(servers[ 0 ], servers[ 1 ]) + await doubleFollow(servers[0], servers[1]) // Server 1 and server 3 follow each other - await doubleFollow(servers[ 0 ], servers[ 2 ]) + await doubleFollow(servers[0], servers[2]) // Server 2 and server 3 follow each other - await doubleFollow(servers[ 1 ], servers[ 2 ]) + await doubleFollow(servers[1], servers[2]) await waitJobs(servers) } @@ -115,7 +115,7 @@ async function check1WebSeed (videoUUID?: string) { if (!videoUUID) videoUUID = video1Server2UUID const webseeds = [ - `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}` + `http://localhost:${servers[1].port}/static/webseed/${videoUUID}` ] for (const server of servers) { @@ -133,8 +133,8 @@ async function check2Webseeds (videoUUID?: string) { if (!videoUUID) videoUUID = video1Server2UUID const webseeds = [ - `http://localhost:${servers[ 0 ].port}/static/redundancy/${videoUUID}`, - `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}` + `http://localhost:${servers[0].port}/static/redundancy/${videoUUID}`, + `http://localhost:${servers[1].port}/static/webseed/${videoUUID}` ] for (const server of servers) { @@ -269,12 +269,12 @@ async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategyWithManu } async function enableRedundancyOnServer1 () { - await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true) + await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true) - const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' }) + const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' }) const follows: ActorFollow[] = res.body.data - const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`) - const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`) + const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) + const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) expect(server3).to.not.be.undefined expect(server3.following.hostRedundancyAllowed).to.be.false @@ -284,12 +284,12 @@ async function enableRedundancyOnServer1 () { } async function disableRedundancyOnServer1 () { - await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, false) + await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, false) - const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' }) + const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' }) const follows: ActorFollow[] = res.body.data - const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`) - const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`) + const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) + const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) expect(server3).to.not.be.undefined expect(server3.following.hostRedundancyAllowed).to.be.false @@ -434,8 +434,8 @@ describe('Test videos redundancy', function () { it('Should view 2 times the first video to have > min_views config', async function () { this.timeout(80000) - await viewVideo(servers[ 0 ].url, video1Server2UUID) - await viewVideo(servers[ 2 ].url, video1Server2UUID) + await viewVideo(servers[0].url, video1Server2UUID) + await viewVideo(servers[2].url, video1Server2UUID) await wait(10000) await waitJobs(servers) @@ -620,7 +620,7 @@ describe('Test videos redundancy', function () { await check1PlaylistRedundancies() await checkStatsWith2Webseed(strategy) - const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' }) + const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' }) video2Server2UUID = res.body.video.uuid }) @@ -652,8 +652,8 @@ describe('Test videos redundancy', function () { await waitJobs(servers) - killallServers([ servers[ 0 ] ]) - await reRunServer(servers[ 0 ], { + killallServers([ servers[0] ]) + await reRunServer(servers[0], { redundancy: { videos: { check_interval: '1 second', -- cgit v1.2.3