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/check-params/accounts.ts | 2 +- server/tests/api/check-params/blocklist.ts | 2 +- server/tests/api/check-params/config.ts | 2 +- server/tests/api/check-params/contact-form.ts | 18 ++-------- server/tests/api/check-params/debug.ts | 7 ++-- server/tests/api/check-params/follows.ts | 2 +- server/tests/api/check-params/jobs.ts | 8 ++--- server/tests/api/check-params/logs.ts | 8 ++--- server/tests/api/check-params/plugins.ts | 2 +- server/tests/api/check-params/redundancy.ts | 4 +-- server/tests/api/check-params/search.ts | 2 +- server/tests/api/check-params/services.ts | 2 +- .../tests/api/check-params/user-notifications.ts | 2 +- .../tests/api/check-params/user-subscriptions.ts | 2 +- server/tests/api/check-params/users.ts | 13 ++++---- server/tests/api/check-params/video-abuses.ts | 4 ++- server/tests/api/check-params/video-blacklist.ts | 15 ++++----- server/tests/api/check-params/video-captions.ts | 4 +-- server/tests/api/check-params/video-channels.ts | 12 +++---- server/tests/api/check-params/video-comments.ts | 2 +- server/tests/api/check-params/video-imports.ts | 17 +++++----- server/tests/api/check-params/video-playlists.ts | 7 ++-- server/tests/api/check-params/videos-filter.ts | 6 ++-- server/tests/api/check-params/videos-history.ts | 9 ++--- server/tests/api/check-params/videos.ts | 38 +++++++++++----------- 25 files changed, 85 insertions(+), 105 deletions(-) (limited to 'server/tests/api/check-params') diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index 4f79685bd..c29af7cd7 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index 0661676ce..fb459f756 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 443fbcb60..f1a79806b 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { omit } from 'lodash' import 'mocha' diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index b3051945e..b2126b9b0 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts @@ -1,22 +1,8 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - flushTests, - immutableAssign, - killallServers, - reRunServer, - flushAndRunServer, - ServerInfo, - setAccessTokensToServers, cleanupTests -} from '../../../../shared/extra-utils' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination -} from '../../../../shared/extra-utils/requests/check-api-params' -import { getAccount } from '../../../../shared/extra-utils/users/accounts' +import { cleanupTests, flushAndRunServer, immutableAssign, killallServers, reRunServer, ServerInfo } from '../../../../shared/extra-utils' import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form' import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts index 8dad26723..5fac73485 100644 --- a/server/tests/api/check-params/debug.ts +++ b/server/tests/api/check-params/debug.ts @@ -1,15 +1,14 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { + cleanupTests, createUser, - flushTests, - killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, - userLogin, cleanupTests + userLogin } from '../../../../shared/extra-utils' import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index be2a603a3..2c2224a45 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts index 22e237964..8f4af8d16 100644 --- a/server/tests/api/check-params/jobs.ts +++ b/server/tests/api/check-params/jobs.ts @@ -1,16 +1,14 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { + cleanupTests, createUser, - flushTests, - killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, - userLogin, - cleanupTests + userLogin } from '../../../../shared/extra-utils' import { checkBadCountPagination, diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts index f9d96bcc0..719da54e6 100644 --- a/server/tests/api/check-params/logs.ts +++ b/server/tests/api/check-params/logs.ts @@ -1,16 +1,14 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { + cleanupTests, createUser, - flushTests, - killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, - userLogin, - cleanupTests + userLogin } from '../../../../shared/extra-utils' import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts index 9553bce17..cf80b35c2 100644 --- a/server/tests/api/check-params/plugins.ts +++ b/server/tests/api/check-params/plugins.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts index 7012a39ee..b2370a094 100644 --- a/server/tests/api/check-params/redundancy.ts +++ b/server/tests/api/check-params/redundancy.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' @@ -38,7 +38,7 @@ describe('Test server redundancy API validators', function () { password: 'password' } - await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password }) + await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) userAccessToken = await userLogin(servers[0], user) videoIdLocal = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video' })).id diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index 8ad9d98bf..f8d0cd4ec 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts index d15753aed..457adfaab 100644 --- a/server/tests/api/check-params/services.ts +++ b/server/tests/api/check-params/services.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 3b06be7ef..2048fa667 100644 --- a/server/tests/api/check-params/user-notifications.ts +++ b/server/tests/api/check-params/user-notifications.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import * as io from 'socket.io-client' diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts index fa36c4078..1edba4d64 100644 --- a/server/tests/api/check-params/user-subscriptions.ts +++ b/server/tests/api/check-params/user-subscriptions.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 5d5af284c..f448bb2a6 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { omit } from 'lodash' import 'mocha' @@ -50,6 +50,7 @@ describe('Test users API validators', function () { let serverWithRegistrationDisabled: ServerInfo let userAccessToken = '' let moderatorAccessToken = '' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let channelId: number // --------------------------------------------------------------- @@ -120,7 +121,7 @@ describe('Test users API validators', function () { { const res = await getMyUserInformation(server.url, server.accessToken) - channelId = res.body.videoChannels[ 0 ].id + channelId = res.body.videoChannels[0].id } { @@ -529,7 +530,7 @@ describe('Test users API validators', function () { it('Should fail without an incorrect input file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -537,7 +538,7 @@ describe('Test users API validators', function () { it('Should fail with a big file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -545,7 +546,7 @@ describe('Test users API validators', function () { it('Should fail with an unauthenticated user', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, @@ -559,7 +560,7 @@ describe('Test users API validators', function () { it('Should succeed with the correct params', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts index bf29f8d4d..bea2177f3 100644 --- a/server/tests/api/check-params/video-abuses.ts +++ b/server/tests/api/check-params/video-abuses.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' @@ -126,6 +126,7 @@ describe('Test video abuses API validators', function () { describe('When updating a video abuse', function () { const basePath = '/api/v1/videos/' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let path: string before(() => { @@ -163,6 +164,7 @@ describe('Test video abuses API validators', function () { describe('When deleting a video abuse', function () { const basePath = '/api/v1/videos/' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let path: string before(() => { diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 6466888fb..145f43980 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' @@ -7,25 +7,24 @@ import { createUser, doubleFollow, flushAndRunMultipleServers, - flushTests, getBlacklistedVideosList, getVideo, getVideoWithToken, - killallServers, makePostBodyRequest, makePutBodyRequest, removeVideoFromBlacklist, ServerInfo, setAccessTokensToServers, uploadVideo, - userLogin, waitJobs + userLogin, + waitJobs } from '../../../../shared/extra-utils' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../../../shared/extra-utils/requests/check-api-params' -import { VideoDetails, VideoBlacklistType } from '../../../../shared/models/videos' +import { VideoBlacklistType, VideoDetails } from '../../../../shared/models/videos' import { expect } from 'chai' describe('Test video blacklist API validators', function () { @@ -48,14 +47,14 @@ describe('Test video blacklist API validators', function () { { const username = 'user1' const password = 'my super password' - await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password }) + await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password }) userAccessToken1 = await userLogin(servers[0], { username, password }) } { const username = 'user2' const password = 'my super password' - await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password }) + await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password }) userAccessToken2 = await userLogin(servers[0], { username, password }) } @@ -120,7 +119,7 @@ describe('Test video blacklist API validators', function () { it('Should succeed with the correct params', async function () { const path = basePath + servers[0].video.uuid + '/blacklist' - const fields = { } + const fields = {} await makePostBodyRequest({ url: servers[0].url, path, token: servers[0].accessToken, fields, statusCodeExpected: 204 }) }) diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 6ddc20d69..a5f5c3322 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { @@ -50,7 +50,7 @@ describe('Test video captions API validator', function () { describe('When adding video caption', function () { const fields = { } const attaches = { - 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt') + captionfile: join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt') } it('Should fail without a valid uuid', async function () { diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index de88298d1..2795ad7d5 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.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 { omit } from 'lodash' @@ -243,7 +243,7 @@ describe('Test video channels API validator', function () { it('Should fail with an incorrect input file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -251,7 +251,7 @@ describe('Test video channels API validator', function () { it('Should fail with a big file', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path: path + '/avatar/pick', token: server.accessToken, fields, attaches }) }) @@ -259,7 +259,7 @@ describe('Test video channels API validator', function () { it('Should fail with an unauthenticated user', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, @@ -273,7 +273,7 @@ describe('Test video channels API validator', function () { it('Should succeed with the correct params', async function () { const fields = {} const attaches = { - 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, @@ -324,7 +324,7 @@ describe('Test video channels API validator', function () { }) it('Should fail with an unknown video channel id', async function () { - await deleteVideoChannel(server.url, server.accessToken,'super_channel2', 404) + await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', 404) }) it('Should succeed with the correct parameters', async function () { diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 5cf90bacc..e67cc01fa 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.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' diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 231d5cc85..dbea39c48 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { omit } from 'lodash' import 'mocha' @@ -29,6 +29,7 @@ describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' let server: ServerInfo let userAccessToken = '' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let accountName: string let channelId: number @@ -48,7 +49,7 @@ describe('Test video imports API validator', function () { { const res = await getMyUserInformation(server.url, server.accessToken) - channelId = res.body.videoChannels[ 0 ].id + channelId = res.body.videoChannels[0].id accountName = res.body.account.name + '@' + res.body.account.host } }) @@ -196,7 +197,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -205,7 +206,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -214,7 +215,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -223,7 +224,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -232,7 +233,7 @@ describe('Test video imports API validator', function () { it('Should fail with an invalid torrent file', async function () { const fields = omit(baseCorrectParams, 'targetUrl') const attaches = { - 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + torrentfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -303,7 +304,7 @@ describe('Test video imports API validator', function () { fields = omit(fields, 'magnetUri') const attaches = { - 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent') + torrentfile: join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 409 }) diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index df158f3b1..0410e737a 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { @@ -36,6 +36,7 @@ describe('Test video playlists API validator', function () { let privatePlaylistUUID: string let watchLaterPlaylistId: number let videoId: number + // eslint-disable-next-line @typescript-eslint/no-unused-vars let videoId2: number let playlistElementId: number @@ -449,7 +450,7 @@ describe('Test video playlists API validator', function () { videoId3 = (await uploadVideoAndGetId({ server, videoName: 'video 3' })).id videoId4 = (await uploadVideoAndGetId({ server, videoName: 'video 4' })).id - for (let id of [ videoId3, videoId4 ]) { + for (const id of [ videoId3, videoId4 ]) { await addVideoInPlaylist({ url: server.url, token: server.accessToken, @@ -476,7 +477,7 @@ describe('Test video playlists API validator', function () { } { - const params = getBase({}, { playlistId: 42, expectedStatus: 404 }) + const params = getBase({}, { playlistId: 42, expectedStatus: 404 }) await reorderVideosPlaylist(params) } }) diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index 811756745..ec8654db2 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts @@ -1,10 +1,9 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { cleanupTests, createUser, - createVideoPlaylist, flushAndRunServer, makeGetRequest, ServerInfo, @@ -13,7 +12,6 @@ import { userLogin } from '../../../../shared/extra-utils' import { UserRole } from '../../../../shared/models/users' -import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: number) { const paths = [ @@ -77,7 +75,7 @@ describe('Test videos filters', function () { }) it('Should succeed with a good filter', async function () { - await testEndpoints(server, server.accessToken,'local', 200) + await testEndpoints(server, server.accessToken, 'local', 200) }) it('Should fail to list all-local with a simple user', async function () { diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts index 3739e3fad..941f62654 100644 --- a/server/tests/api/check-params/videos-history.ts +++ b/server/tests/api/check-params/videos-history.ts @@ -1,6 +1,5 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' import { checkBadCountPagination, @@ -15,12 +14,10 @@ import { uploadVideo } from '../../../../shared/extra-utils' -const expect = chai.expect - describe('Test videos history API validator', function () { + const myHistoryPath = '/api/v1/users/me/history/videos' + const myHistoryRemove = myHistoryPath + '/remove' let watchingPath: string - let myHistoryPath = '/api/v1/users/me/history/videos' - let myHistoryRemove = myHistoryPath + '/remove' let server: ServerInfo // --------------------------------------------------------------- diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 16ef1c505..0d4665954 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.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 { omit } from 'lodash' @@ -56,8 +56,8 @@ describe('Test videos API validator', function () { { const res = await getMyUserInformation(server.url, server.accessToken) - channelId = res.body.videoChannels[ 0 ].id - channelName = res.body.videoChannels[ 0 ].name + channelId = res.body.videoChannels[0].id + channelName = res.body.videoChannels[0].name accountName = res.body.account.name + '@' + res.body.account.host } }) @@ -182,7 +182,7 @@ describe('Test videos API validator', function () { describe('When adding a video', function () { let baseCorrectParams const baseCorrectAttaches = { - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.webm') + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.webm') } before(function () { @@ -330,7 +330,7 @@ describe('Test videos API validator', function () { }) it('Should fail with a bad originally published at attribute', async function () { - const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' }) + const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' }) const attaches = baseCorrectAttaches await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -345,12 +345,12 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect input file', async function () { const fields = baseCorrectParams let attaches = { - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm') + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) attaches = { - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv') + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) }) @@ -358,8 +358,8 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -368,8 +368,8 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -378,8 +378,8 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -388,8 +388,8 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), - 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), + videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) @@ -566,7 +566,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') } await makeUploadRequest({ @@ -582,7 +582,7 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ @@ -598,7 +598,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') } await makeUploadRequest({ @@ -614,7 +614,7 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ -- cgit v1.2.3