From 863477173efa82a4412d2e522aa46462249f9199 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Aug 2022 15:44:32 +0200 Subject: [PATCH] Cleanup tests imports --- server/helpers/custom-validators/misc.ts | 7 ------- server/middlewares/validators/blocklist.ts | 6 +++--- server/middlewares/validators/logs.ts | 5 +++-- .../middlewares/validators/user-subscriptions.ts | 4 ++-- server/middlewares/validators/videos/videos.ts | 15 +++++++-------- server/tests/api/activitypub/cleaner.ts | 5 +---- server/tests/api/activitypub/client.ts | 4 +--- server/tests/api/activitypub/fetch.ts | 5 +---- server/tests/api/activitypub/refresher.ts | 1 - server/tests/api/activitypub/security.ts | 4 +--- server/tests/api/check-params/abuses.ts | 1 - server/tests/api/check-params/blocklist.ts | 1 - .../api/check-params/channel-import-videos.ts | 1 - server/tests/api/check-params/logs.ts | 1 - server/tests/api/check-params/plugins.ts | 1 - server/tests/api/check-params/video-blacklist.ts | 1 - server/tests/api/check-params/video-comments.ts | 4 +--- server/tests/api/live/live-constraints.ts | 4 +--- server/tests/api/live/live-fast-restream.ts | 4 +--- server/tests/api/live/live-permanent.ts | 4 +--- server/tests/api/live/live-rtmps.ts | 4 +--- server/tests/api/live/live-save-replay.ts | 4 +--- server/tests/api/live/live-socket-messages.ts | 4 +--- server/tests/api/live/live.ts | 4 +--- server/tests/api/moderation/abuses.ts | 4 +--- .../api/moderation/blocklist-notification.ts | 4 +--- server/tests/api/moderation/blocklist.ts | 4 +--- server/tests/api/moderation/video-blacklist.ts | 4 +--- .../api/notifications/comments-notifications.ts | 4 +--- .../tests/api/notifications/notifications-api.ts | 4 +--- .../tests/api/notifications/user-notifications.ts | 4 +--- server/tests/api/object-storage/live.ts | 4 +--- server/tests/api/object-storage/video-imports.ts | 4 +--- server/tests/api/object-storage/videos.ts | 4 +--- server/tests/api/redundancy/manage-redundancy.ts | 4 +--- server/tests/api/redundancy/redundancy.ts | 4 +--- .../search/search-activitypub-video-channels.ts | 4 +--- .../search/search-activitypub-video-playlists.ts | 4 +--- .../tests/api/search/search-activitypub-videos.ts | 4 +--- server/tests/api/search/search-channels.ts | 4 +--- server/tests/api/search/search-index.ts | 4 +--- server/tests/api/search/search-playlists.ts | 4 +--- server/tests/api/search/search-videos.ts | 4 +--- server/tests/api/server/auto-follows.ts | 4 +--- server/tests/api/server/bulk.ts | 4 +--- server/tests/api/server/config-defaults.ts | 4 +--- server/tests/api/server/config.ts | 4 +--- server/tests/api/server/contact-form.ts | 4 +--- server/tests/api/server/email.ts | 4 +--- server/tests/api/server/follow-constraints.ts | 4 +--- server/tests/api/server/follows-moderation.ts | 4 +--- server/tests/api/server/follows.ts | 4 +--- server/tests/api/server/handle-down.ts | 4 +--- server/tests/api/server/homepage.ts | 4 +--- server/tests/api/server/jobs.ts | 4 +--- server/tests/api/server/logs.ts | 4 +--- server/tests/api/server/plugins.ts | 4 +--- server/tests/api/server/proxy.ts | 4 +--- server/tests/api/server/services.ts | 4 +--- server/tests/api/server/slow-follows.ts | 4 +--- server/tests/api/server/stats.ts | 4 +--- server/tests/api/transcoding/audio-only.ts | 4 +--- .../tests/api/transcoding/create-transcoding.ts | 4 +--- server/tests/api/transcoding/hls.ts | 4 +--- server/tests/api/users/user-subscriptions.ts | 4 +--- server/tests/api/users/user-videos.ts | 4 +--- server/tests/api/users/users-multiple-servers.ts | 4 +--- server/tests/api/users/users-verification.ts | 4 +--- server/tests/api/users/users.ts | 4 +--- server/tests/api/videos/multiple-servers.ts | 4 +--- server/tests/api/videos/resumable-upload.ts | 4 +--- server/tests/api/videos/single-server.ts | 4 +--- server/tests/api/videos/video-captions.ts | 4 +--- server/tests/api/videos/video-change-ownership.ts | 4 +--- server/tests/api/videos/video-channels.ts | 4 +--- server/tests/api/videos/video-comments.ts | 4 +--- server/tests/api/videos/video-description.ts | 4 +--- server/tests/api/videos/video-nsfw.ts | 4 +--- .../tests/api/videos/video-playlist-thumbnails.ts | 4 +--- server/tests/api/videos/video-playlists.ts | 4 +--- server/tests/api/videos/video-privacy.ts | 4 +--- server/tests/api/videos/video-schedule-update.ts | 4 +--- server/tests/api/videos/video-source.ts | 4 +--- server/tests/api/videos/videos-history.ts | 4 +--- server/tests/api/videos/videos-overview.ts | 4 +--- server/tests/api/views/video-views-counter.ts | 4 +--- .../tests/api/views/video-views-overall-stats.ts | 4 +--- .../api/views/video-views-retention-stats.ts | 4 +--- .../api/views/video-views-timeserie-stats.ts | 4 +--- server/tests/api/views/videos-views-cleaner.ts | 4 +--- server/tests/cli/create-import-video-file-job.ts | 4 +--- server/tests/cli/create-transcoding-job.ts | 4 +--- server/tests/cli/print-transcode-command.ts | 4 +--- server/tests/cli/prune-storage.ts | 4 +--- server/tests/client.ts | 4 +--- server/tests/feeds/feeds.ts | 4 +--- server/tests/helpers/comment-model.ts | 4 +--- server/tests/helpers/core-utils.ts | 4 +--- server/tests/misc-endpoints.ts | 4 +--- server/tests/plugins/filter-hooks.ts | 4 +--- server/tests/plugins/html-injection.ts | 4 +--- server/tests/plugins/translations.ts | 4 +--- server/tests/plugins/video-constants.ts | 4 +--- 103 files changed, 106 insertions(+), 304 deletions(-) diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index c80c86193..17750379d 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts @@ -136,12 +136,6 @@ function toValueOrNull (value: string) { return value } -function toArray (value: any) { - if (value && isArray(value) === false) return [ value ] - - return value -} - function toIntArray (value: any) { if (!value) return [] if (isArray(value) === false) return [ validator.toInt(value) ] @@ -170,7 +164,6 @@ export { isBooleanValid, toIntOrNull, areUUIDsValid, - toArray, toIntArray, isFileValid, checkMimetypeRegex diff --git a/server/middlewares/validators/blocklist.ts b/server/middlewares/validators/blocklist.ts index 1bae3764a..8ec6cb01d 100644 --- a/server/middlewares/validators/blocklist.ts +++ b/server/middlewares/validators/blocklist.ts @@ -1,8 +1,8 @@ import express from 'express' import { body, param, query } from 'express-validator' import { areValidActorHandles } from '@server/helpers/custom-validators/activitypub/actor' -import { toArray } from '@server/helpers/custom-validators/misc' import { getServerActor } from '@server/models/application/application' +import { arrayify } from '@shared/core-utils' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers' import { WEBSERVER } from '../../initializers/constants' @@ -121,12 +121,12 @@ const unblockServerByServerValidator = [ const blocklistStatusValidator = [ query('hosts') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isEachUniqueHostValid).withMessage('Should have a valid hosts array'), query('accounts') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(areValidActorHandles).withMessage('Should have a valid accounts array'), (req: express.Request, res: express.Response, next: express.NextFunction) => { diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index 584cb2aaf..2d828bb42 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts @@ -3,6 +3,7 @@ import { body, query } from 'express-validator' import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc' import { isStringArray } from '@server/helpers/custom-validators/search' import { CONFIG } from '@server/initializers/config' +import { arrayify } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' import { isValidClientLogLevel, @@ -12,7 +13,7 @@ import { isValidClientLogUserAgent, isValidLogLevel } from '../../helpers/custom-validators/logs' -import { isDateValid, toArray } from '../../helpers/custom-validators/misc' +import { isDateValid } from '../../helpers/custom-validators/misc' import { areValidationErrors } from './shared' const createClientLogValidator = [ @@ -56,7 +57,7 @@ const getLogsValidator = [ .custom(isValidLogLevel), query('tagsOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isStringArray).withMessage('Should have a valid one of tags array'), query('endDate') .optional() diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/middlewares/validators/user-subscriptions.ts index a76628915..d01043c17 100644 --- a/server/middlewares/validators/user-subscriptions.ts +++ b/server/middlewares/validators/user-subscriptions.ts @@ -1,8 +1,8 @@ +import { arrayify } from '@shared/core-utils' import express from 'express' import { body, param, query } from 'express-validator' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' -import { toArray } from '../../helpers/custom-validators/misc' import { WEBSERVER } from '../../initializers/constants' import { ActorFollowModel } from '../../models/actor/actor-follow' import { areValidationErrors } from './shared' @@ -32,7 +32,7 @@ const userSubscriptionAddValidator = [ const areSubscriptionsExistValidator = [ query('uris') - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(areValidActorHandles).withMessage('Should have a valid array of URIs'), (req: express.Request, res: express.Response, next: express.NextFunction) => { diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 3d93bc62f..7fd2b03d1 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -6,7 +6,7 @@ import { Redis } from '@server/lib/redis' import { getServerActor } from '@server/models/application/application' import { ExpressPromiseHandler } from '@server/types/express-handler' import { MUserAccountId, MVideoFullLight } from '@server/types/models' -import { getAllPrivacies } from '@shared/core-utils' +import { arrayify, getAllPrivacies } from '@shared/core-utils' import { HttpStatusCode, ServerErrorCode, UserRight, VideoInclude } from '@shared/models' import { exists, @@ -14,7 +14,6 @@ import { isDateValid, isFileValid, isIdValid, - toArray, toBooleanOrNull, toIntOrNull, toValueOrNull @@ -419,27 +418,27 @@ function getCommonVideoEditAttributes () { const commonVideosFiltersValidator = [ query('categoryOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isNumberArray).withMessage('Should have a valid categoryOneOf array'), query('licenceOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isNumberArray).withMessage('Should have a valid licenceOneOf array'), query('languageOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isStringArray).withMessage('Should have a valid languageOneOf array'), query('privacyOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isNumberArray).withMessage('Should have a valid privacyOneOf array'), query('tagsOneOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isStringArray).withMessage('Should have a valid tagsOneOf array'), query('tagsAllOf') .optional() - .customSanitizer(toArray) + .customSanitizer(arrayify) .custom(isStringArray).withMessage('Should have a valid tagsAllOf array'), query('nsfw') .optional() diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index d0a151f5c..eb6779123 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { cleanupTests, @@ -12,8 +11,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test AP cleaner', function () { let servers: PeerTubeServer[] = [] let videoUUID1: string diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts index b12ffe341..90c89138c 100644 --- a/server/tests/api/activitypub/client.ts +++ b/server/tests/api/activitypub/client.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { processViewersStats } from '@server/tests/shared' import { HttpStatusCode, VideoPlaylistPrivacy, WatchActionObject } from '@shared/models' import { @@ -13,8 +13,6 @@ import { setDefaultVideoChannel } from '@shared/server-commands' -const expect = chai.expect - describe('Test activitypub', function () { let servers: PeerTubeServer[] = [] let video: { id: number, uuid: string, shortUUID: string } diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index cc71e82ea..4edabd1d9 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createMultipleServers, @@ -11,8 +10,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test ActivityPub fetcher', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index bb81d4565..401a09090 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { wait } from '@shared/core-utils' import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' import { diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 5e29b744f..423fefb10 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { buildDigest } from '@server/helpers/peertube-crypto' import { HTTP_SIGNATURE } from '@server/initializers/constants' import { activityPubContextify } from '@server/lib/activitypub/context' @@ -10,8 +10,6 @@ import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands' -const expect = chai.expect - function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) { const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts index 7d8347412..331d3f8f7 100644 --- a/server/tests/api/check-params/abuses.ts +++ b/server/tests/api/check-params/abuses.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models' import { diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index 36526d494..f745b9088 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' import { diff --git a/server/tests/api/check-params/channel-import-videos.ts b/server/tests/api/check-params/channel-import-videos.ts index 14587c376..0ec5fc2b9 100644 --- a/server/tests/api/check-params/channel-import-videos.ts +++ b/server/tests/api/check-params/channel-import-videos.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { FIXTURE_URLS } from '@server/tests/shared' import { areHttpImportTestsDisabled } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts index f9a99796d..2496cee31 100644 --- a/server/tests/api/check-params/logs.ts +++ b/server/tests/api/check-params/logs.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { expect } from 'chai' import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts index c3f15b86e..02f0d010d 100644 --- a/server/tests/api/check-params/plugins.ts +++ b/server/tests/api/check-params/plugins.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models' import { diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 0ec3f49d5..4dc84d3f2 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { expect } from 'chai' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode, VideoBlacklistType } from '@shared/models' diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index ccf36948e..550198844 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' import { @@ -13,8 +13,6 @@ import { setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test video comments API validator', function () { let pathThread: string let pathComment: string diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 876538302..64ef73a2a 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { LiveVideoError, VideoPrivacy } from '@shared/models' import { @@ -18,8 +18,6 @@ import { } from '@shared/server-commands' import { checkLiveCleanup } from '../../shared' -const expect = chai.expect - describe('Test live constraints', function () { let servers: PeerTubeServer[] = [] let userId: number diff --git a/server/tests/api/live/live-fast-restream.ts b/server/tests/api/live/live-fast-restream.ts index d3dae9e98..502959258 100644 --- a/server/tests/api/live/live-fast-restream.ts +++ b/server/tests/api/live/live-fast-restream.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models' import { @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Fast restream in live', function () { let server: PeerTubeServer diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index da392ba84..5d227200e 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { @@ -15,8 +15,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Permanent live', function () { let servers: PeerTubeServer[] = [] let videoUUID: string diff --git a/server/tests/api/live/live-rtmps.ts b/server/tests/api/live/live-rtmps.ts index 46cfef989..dcaee90cf 100644 --- a/server/tests/api/live/live-rtmps.ts +++ b/server/tests/api/live/live-rtmps.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { buildAbsoluteFixturePath } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { @@ -15,8 +15,6 @@ import { waitUntilLivePublishedOnAllServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test live RTMPS', function () { let server: PeerTubeServer let rtmpUrl: string diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 80df93924..7014292d0 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' import { checkLiveCleanup } from '@server/tests/shared' import { wait } from '@shared/core-utils' @@ -22,8 +22,6 @@ import { waitUntilLiveWaitingOnAllServers } from '@shared/server-commands' -const expect = chai.expect - describe('Save replay setting', function () { let servers: PeerTubeServer[] = [] let liveVideoUUID: string diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 7c2b449ac..62b7a6d22 100644 --- a/server/tests/api/live/live-socket-messages.ts +++ b/server/tests/api/live/live-socket-messages.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoPrivacy, VideoState } from '@shared/models' import { @@ -15,8 +15,6 @@ import { waitUntilLivePublishedOnAllServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test live socket messages', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 8d3bf61a1..48982f4de 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { basename, join } from 'path' import { ffprobePromise, getVideoStream } from '@server/helpers/ffmpeg' import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist, getAllFiles, testImage } from '@server/tests/shared' @@ -32,8 +32,6 @@ import { waitUntilLivePublishedOnAllServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test live', function () { let servers: PeerTubeServer[] = [] let commands: LiveCommand[] diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts index 1c083a3d1..d9c164c43 100644 --- a/server/tests/api/moderation/abuses.ts +++ b/server/tests/api/moderation/abuses.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models' import { AbusesCommand, @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test abuses', function () { let servers: PeerTubeServer[] = [] let abuseServer1: AdminAbuse diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index d5d0e5178..eb092a1df 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { UserNotificationType } from '@shared/models' import { cleanupTests, @@ -11,8 +11,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType[]) { const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true }) expect(data).to.have.lengthOf(expected.length) diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index ef2c5d7f3..27592e8c5 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { UserNotificationType } from '@shared/models' import { BlocklistCommand, @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkAllVideos (server: PeerTubeServer, token: string) { { const { data } = await server.videos.listWithToken({ token }) diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts index 68823f97a..ad132aa39 100644 --- a/server/tests/api/moderation/video-blacklist.ts +++ b/server/tests/api/moderation/video-blacklist.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FIXTURE_URLS } from '@server/tests/shared' import { sortObjectComparator } from '@shared/core-utils' import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models' @@ -16,8 +16,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video blacklist', function () { let servers: PeerTubeServer[] = [] let videoId: number diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index 7bbec736b..4214687f8 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkCommentMention, CheckerBaseParams, @@ -11,8 +11,6 @@ import { import { UserNotification } from '@shared/models' import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test comments notifications', function () { let servers: PeerTubeServer[] = [] let userToken: string diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index e5d883538..f194656c9 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { CheckerBaseParams, checkNewVideoFromSubscription, @@ -11,8 +11,6 @@ import { import { UserNotification, UserNotificationSettingValue } from '@shared/models' import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test notifications API', function () { let server: PeerTubeServer let userNotifications: UserNotification[] = [] diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index ca5e15738..c05f3330a 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { CheckerBaseParams, checkMyVideoImportIsFinished, @@ -18,8 +18,6 @@ import { buildUUID } from '@shared/extra-utils' import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@shared/models' import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test user notifications', function () { let servers: PeerTubeServer[] = [] let userAccessToken: string diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index 94fff8f6b..0958ffe0f 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { expectStartWith } from '@server/tests/shared' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, LiveVideoCreate, VideoFile, VideoPrivacy } from '@shared/models' @@ -21,8 +21,6 @@ import { waitUntilLiveWaitingOnAllServers } from '@shared/server-commands' -const expect = chai.expect - async function createLive (server: PeerTubeServer, permanent: boolean) { const attributes: LiveVideoCreate = { channelId: server.store.channel.id, diff --git a/server/tests/api/object-storage/video-imports.ts b/server/tests/api/object-storage/video-imports.ts index 141ead2f7..f688c7018 100644 --- a/server/tests/api/object-storage/video-imports.ts +++ b/server/tests/api/object-storage/video-imports.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { expectStartWith, FIXTURE_URLS } from '@server/tests/shared' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' @@ -15,8 +15,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function importVideo (server: PeerTubeServer) { const attributes = { name: 'import 2', diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts index cdb68b962..3e65e1093 100644 --- a/server/tests/api/object-storage/videos.ts +++ b/server/tests/api/object-storage/videos.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import bytes from 'bytes' -import * as chai from 'chai' +import { expect } from 'chai' import { stat } from 'fs-extra' import { merge } from 'lodash' import { @@ -27,8 +27,6 @@ import { webtorrentAdd } from '@shared/server-commands' -const expect = chai.expect - async function checkFiles (options: { video: VideoDetails diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts index b607900f8..404b65a99 100644 --- a/server/tests/api/redundancy/manage-redundancy.ts +++ b/server/tests/api/redundancy/manage-redundancy.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createMultipleServers, @@ -12,8 +12,6 @@ import { } from '@shared/server-commands' import { VideoPrivacy, VideoRedundanciesTarget } from '@shared/models' -const expect = chai.expect - describe('Test manage videos redundancy', function () { const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ] diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index cc150e02e..5abed358f 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { readdir } from 'fs-extra' import magnetUtil from 'magnet-uri' import { basename, join } from 'path' @@ -25,8 +25,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - let servers: PeerTubeServer[] = [] let video1Server2: VideoDetails diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 118be11af..06a206d21 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoChannel } from '@shared/models' import { @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test ActivityPub video channels search', function () { let servers: PeerTubeServer[] let userServer2Token: string diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts index 1ba9ce2c4..25b162074 100644 --- a/server/tests/api/search/search-activitypub-video-playlists.ts +++ b/server/tests/api/search/search-activitypub-video-playlists.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoPlaylistPrivacy } from '@shared/models' import { @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test ActivityPub playlists search', function () { let servers: PeerTubeServer[] let playlistServer1UUID: string diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index b17b92dca..4c7118422 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test ActivityPub videos search', function () { let servers: PeerTubeServer[] let videoServer1UUID: string diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index cab8e6292..c6b098a93 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { VideoChannel } from '@shared/models' import { cleanupTests, @@ -13,8 +13,6 @@ import { setDefaultChannelAvatar } from '@shared/server-commands' -const expect = chai.expect - describe('Test channels search', function () { let server: PeerTubeServer let remoteServer: PeerTubeServer diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index ece6c0475..c61ac441d 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { BooleanBothQuery, VideoChannelsSearchQuery, @@ -11,8 +11,6 @@ import { } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test index search', function () { const localVideoName = 'local video' + new Date().toISOString() diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index 8d48de641..a357674c2 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { VideoPlaylistPrivacy } from '@shared/models' import { cleanupTests, @@ -14,8 +14,6 @@ import { setDefaultVideoChannel } from '@shared/server-commands' -const expect = chai.expect - describe('Test playlists search', function () { let server: PeerTubeServer let remoteServer: PeerTubeServer diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 5f2da55e2..5e85e3aa7 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { @@ -16,8 +16,6 @@ import { stopFfmpeg } from '@shared/server-commands' -const expect = chai.expect - describe('Test videos search', function () { let server: PeerTubeServer let remoteServer: PeerTubeServer diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts index 9666e61dd..cdaadb3ad 100644 --- a/server/tests/api/server/auto-follows.ts +++ b/server/tests/api/server/auto-follows.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { MockInstancesIndex } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkFollow (follower: PeerTubeServer, following: PeerTubeServer, exists: boolean) { { const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' }) diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts index 560dcc76e..05762c7c2 100644 --- a/server/tests/api/server/bulk.ts +++ b/server/tests/api/server/bulk.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { BulkCommand, cleanupTests, @@ -11,8 +11,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test bulk actions', function () { const commentsUser3: { videoId: number, commentId: number }[] = [] diff --git a/server/tests/api/server/config-defaults.ts b/server/tests/api/server/config-defaults.ts index 47ee4746d..4fa37d0e2 100644 --- a/server/tests/api/server/config-defaults.ts +++ b/server/tests/api/server/config-defaults.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FIXTURE_URLS } from '@server/tests/shared' import { VideoDetails, VideoPrivacy } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' -const expect = chai.expect - describe('Test config defaults', function () { let server: PeerTubeServer let channelId: number diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 2b2b093a7..b8c99e804 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { parallelTests } from '@shared/core-utils' import { CustomConfig, HttpStatusCode } from '@shared/models' import { @@ -12,8 +12,6 @@ import { setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) { expect(data.instance.name).to.equal('PeerTube') expect(data.instance.shortDescription).to.equal( diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index 3eb6c8548..fcd7f3c4c 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { MockSmtpServer } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' @@ -13,8 +13,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test contact form', function () { let server: PeerTubeServer const emails: object[] = [] diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 5ac66225f..1826c268a 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test emails', function () { let server: PeerTubeServer let userId: number diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts index c5c8c8595..5998f58cc 100644 --- a/server/tests/api/server/follow-constraints.ts +++ b/server/tests/api/server/follow-constraints.ts @@ -1,11 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' -const expect = chai.expect - describe('Test follow constraints', function () { let servers: PeerTubeServer[] = [] let video1UUID: string diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.ts index dc189fec5..deeaac85a 100644 --- a/server/tests/api/server/follows-moderation.ts +++ b/server/tests/api/server/follows-moderation.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { expectStartWith } from '@server/tests/shared' import { ActorFollow, FollowState } from '@shared/models' import { @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkServer1And2HasFollowers (servers: PeerTubeServer[], state = 'accepted') { const fns = [ servers[0].follows.getFollowings.bind(servers[0].follows), diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 3ff8c3583..96d39352b 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { completeVideoCheck, dateIsValid, expectAccountFollows, expectChannelsFollows, testCaptionFile } from '@server/tests/shared' import { VideoCreateResult, VideoPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test follows', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 78b3f8560..9ace65ddf 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { completeVideoCheck } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test handle downs', function () { let servers: PeerTubeServer[] = [] let threadIdServer1: number diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts index 1867826d6..9c45800f2 100644 --- a/server/tests/api/server/homepage.ts +++ b/server/tests/api/server/homepage.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { HttpStatusCode } from '@shared/models' import { cleanupTests, @@ -13,8 +13,6 @@ import { setDefaultChannelAvatar } from '../../../../shared/server-commands/index' -const expect = chai.expect - async function getHomepageState (server: PeerTubeServer) { const config = await server.config.getConfig() diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 8217da19b..211e32b1e 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { dateIsValid } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test jobs', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.ts index 8e626c9df..3b3314d34 100644 --- a/server/tests/api/server/logs.ts +++ b/server/tests/api/server/logs.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { HttpStatusCode } from '@shared/models' import { cleanupTests, @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test logs', function () { let server: PeerTubeServer let logsCommand: LogsCommand diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index fbcf4651e..8ac7023eb 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { pathExists, remove } from 'fs-extra' import { join } from 'path' import { testHelloWorldRegisteredSettings } from '@server/tests/shared' @@ -16,8 +16,6 @@ import { setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test plugins', function () { let server: PeerTubeServer = null let command: PluginsCommand diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index 851bed058..a4151ebdd 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' @@ -15,8 +15,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test proxy', function () { let servers: PeerTubeServer[] = [] let proxy: MockProxy diff --git a/server/tests/api/server/services.ts b/server/tests/api/server/services.ts index ed7aca6b6..380308a34 100644 --- a/server/tests/api/server/services.ts +++ b/server/tests/api/server/services.ts @@ -1,11 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' import { Video, VideoPlaylistPrivacy } from '@shared/models' -const expect = chai.expect - describe('Test services', function () { let server: PeerTubeServer = null let playlistUUID: string diff --git a/server/tests/api/server/slow-follows.ts b/server/tests/api/server/slow-follows.ts index 73ac26bf8..a967fa724 100644 --- a/server/tests/api/server/slow-follows.ts +++ b/server/tests/api/server/slow-follows.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { Job } from '@shared/models' import { cleanupTests, @@ -11,8 +11,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test slow follows', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index 6dad22aa1..762fc422d 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { ActivityType, VideoPlaylistPrivacy } from '@shared/models' import { @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test stats (excluding redundancy)', function () { let servers: PeerTubeServer[] = [] let channelId diff --git a/server/tests/api/transcoding/audio-only.ts b/server/tests/api/transcoding/audio-only.ts index da1d50eb2..1897c6d6d 100644 --- a/server/tests/api/transcoding/audio-only.ts +++ b/server/tests/api/transcoding/audio-only.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { getAudioStream, getVideoStreamDimensionsInfo } from '@server/helpers/ffmpeg' import { cleanupTests, @@ -11,8 +11,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test audio only video transcoding', function () { let servers: PeerTubeServer[] = [] let videoUUID: string diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts index e1972f275..a50bf7654 100644 --- a/server/tests/api/transcoding/create-transcoding.ts +++ b/server/tests/api/transcoding/create-transcoding.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkResolutionsInMasterPlaylist, expectStartWith } from '@server/tests/shared' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoDetails } from '@shared/models' @@ -17,8 +17,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkFilesInObjectStorage (video: VideoDetails) { for (const file of video.files) { expectStartWith(file.fileUrl, ObjectStorageCommand.getWebTorrentBaseUrl()) diff --git a/server/tests/api/transcoding/hls.ts b/server/tests/api/transcoding/hls.ts index a7ac97e0a..252422e5d 100644 --- a/server/tests/api/transcoding/hls.ts +++ b/server/tests/api/transcoding/hls.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { basename, join } from 'path' import { checkDirectoryIsEmpty, @@ -25,8 +25,6 @@ import { } from '@shared/server-commands' import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' -const expect = chai.expect - async function checkHlsPlaylist (options: { servers: PeerTubeServer[] videoUUID: string diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index c024fa75c..894a49f98 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { VideoPrivacy } from '@shared/models' import { cleanupTests, @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test users subscriptions', function () { let servers: PeerTubeServer[] = [] const users: { accessToken: string }[] = [] diff --git a/server/tests/api/users/user-videos.ts b/server/tests/api/users/user-videos.ts index 87040d2e4..4343c1e49 100644 --- a/server/tests/api/users/user-videos.ts +++ b/server/tests/api/users/user-videos.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { HttpStatusCode } from '@shared/models' import { cleanupTests, @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test user videos', function () { let server: PeerTubeServer let videoId: number diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index d1b9f76f9..62d668d1e 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkActorFilesWereRemoved, checkTmpIsEmpty, @@ -19,8 +19,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test users with multiple servers', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index 3d657f73e..fc082383a 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test users account verification', function () { let server: PeerTubeServer let userId: number diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 3fd68cfe6..9e657b387 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { testImage } from '@server/tests/shared' import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models' import { @@ -12,8 +12,6 @@ import { setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test users', function () { let server: PeerTubeServer let token: string diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 766cc8236..23790ba65 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import request from 'supertest' import { checkTmpIsEmpty, @@ -25,8 +25,6 @@ import { webtorrentAdd } from '@shared/server-commands' -const expect = chai.expect - describe('Test multiple servers', function () { let servers: PeerTubeServer[] = [] const toRemove = [] diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index 9936d5467..0625828a1 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { pathExists, readdir, stat } from 'fs-extra' import { join } from 'path' import { buildAbsoluteFixturePath } from '@shared/core-utils' @@ -8,8 +8,6 @@ import { sha1 } from '@shared/extra-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' -const expect = chai.expect - // Most classic resumable upload tests are done in other test suites describe('Test resumable upload', function () { diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 574fb523e..da8bde07b 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { Video, VideoPrivacy } from '@shared/models' @@ -14,8 +14,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test a single server', function () { function runSuite (mode: 'legacy' | 'resumable') { diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index b68e5e6e8..0630c9d3a 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkVideoFilesWereRemoved, testCaptionFile } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video captions', function () { const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index 85bc191b6..e9ef67493 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { ChangeOwnershipCommand, cleanupTests, @@ -14,8 +14,6 @@ import { } from '@shared/server-commands' import { HttpStatusCode, VideoPrivacy } from '@shared/models' -const expect = chai.expect - describe('Test video change ownership - nominal', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index b7645ea59..86a8a038c 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { basename } from 'path' import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' import { testFileExistsOrNot, testImage } from '@server/tests/shared' @@ -17,8 +17,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function findChannel (server: PeerTubeServer, channelId: number) { const body = await server.channels.list({ sort: '-name' }) diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 6d74a865f..348b408e8 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { dateIsValid, testImage } from '@server/tests/shared' import { cleanupTests, @@ -12,8 +12,6 @@ import { setDefaultChannelAvatar } from '@shared/server-commands' -const expect = chai.expect - describe('Test video comments', function () { let server: PeerTubeServer let videoId: number diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index 347325741..a74b78a5f 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createMultipleServers, @@ -10,8 +10,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video description', function () { let servers: PeerTubeServer[] = [] let videoUUID = '' diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index cfa130043..65e9c8730 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts @@ -1,11 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' -const expect = chai.expect - function createOverviewRes (overview: VideosOverview) { const videos = overview.categories[0].videos return { data: videos, total: videos.length } diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts index 019f34b6b..356939b93 100644 --- a/server/tests/api/videos/video-playlist-thumbnails.ts +++ b/server/tests/api/videos/video-playlist-thumbnails.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { testImage } from '@server/tests/shared' import { VideoPlaylistPrivacy } from '@shared/models' import { @@ -13,8 +13,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Playlist thumbnail', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index dd5f6a3ca..47b8c7b1e 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { checkPlaylistFilesWereRemoved, testImage } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { @@ -24,8 +24,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function checkPlaylistElementType ( servers: PeerTubeServer[], playlistId: string, diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index 711622df9..b18c71c94 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video privacy', function () { const servers: PeerTubeServer[] = [] let anotherUserToken: string diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index 7865b3439..73f1519d9 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - function in10Seconds () { const now = new Date() now.setSeconds(now.getSeconds() + 10) diff --git a/server/tests/api/videos/video-source.ts b/server/tests/api/videos/video-source.ts index 4c1641ed0..5ecf8316f 100644 --- a/server/tests/api/videos/video-source.ts +++ b/server/tests/api/videos/video-source.ts @@ -1,8 +1,6 @@ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test video source', () => { let server: PeerTubeServer = null const fixture = 'video_short.webm' diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index 500744e40..6df26ab7d 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { Video } from '@shared/models' import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test videos history', function () { let server: PeerTubeServer = null let video1Id: number diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index 5159e8248..c012d47c3 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { VideosOverview } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test a videos overview', function () { let server: PeerTubeServer = null diff --git a/server/tests/api/views/video-views-counter.ts b/server/tests/api/views/video-views-counter.ts index 9ade1dc0c..ca33ff9cd 100644 --- a/server/tests/api/views/video-views-counter.ts +++ b/server/tests/api/views/video-views-counter.ts @@ -1,13 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' import { prepareViewsServers, prepareViewsVideos, processViewsBuffer } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video views/viewers counters', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/views/video-views-overall-stats.ts b/server/tests/api/views/video-views-overall-stats.ts index b21d70c0b..bb00684ef 100644 --- a/server/tests/api/views/video-views-overall-stats.ts +++ b/server/tests/api/views/video-views-overall-stats.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared' import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test views overall stats', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/views/video-views-retention-stats.ts b/server/tests/api/views/video-views-retention-stats.ts index 307d6de07..621b05110 100644 --- a/server/tests/api/views/video-views-retention-stats.ts +++ b/server/tests/api/views/video-views-retention-stats.ts @@ -1,11 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared' import { cleanupTests, PeerTubeServer } from '@shared/server-commands' -const expect = chai.expect - describe('Test views retention stats', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/views/video-views-timeserie-stats.ts b/server/tests/api/views/video-views-timeserie-stats.ts index d6c89a63e..e8cb34ad6 100644 --- a/server/tests/api/views/video-views-timeserie-stats.ts +++ b/server/tests/api/views/video-views-timeserie-stats.ts @@ -1,13 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared' import { VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models' import { cleanupTests, PeerTubeServer, stopFfmpeg } from '@shared/server-commands' -const expect = chai.expect - function buildOneMonthAgo () { const monthAgo = new Date() monthAgo.setHours(0, 0, 0, 0) diff --git a/server/tests/api/views/videos-views-cleaner.ts b/server/tests/api/views/videos-views-cleaner.ts index e28f82668..7c543a74a 100644 --- a/server/tests/api/views/videos-views-cleaner.ts +++ b/server/tests/api/views/videos-views-cleaner.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { wait } from '@shared/core-utils' import { cleanupTests, @@ -12,8 +12,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test video views cleaner', function () { let servers: PeerTubeServer[] diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index aa24e6996..2cf2dd8f8 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models' import { @@ -15,8 +15,6 @@ import { } from '@shared/server-commands' import { expectStartWith } from '../shared' -const expect = chai.expect - function assertVideoProperties (video: VideoFile, resolution: number, extname: string, size?: number) { expect(video).to.have.nested.property('resolution.id', resolution) expect(video).to.have.property('torrentUrl').that.includes(`-${resolution}.torrent`) diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 48302c9e4..8897d8c23 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { areObjectStorageTestsDisabled } from '@shared/core-utils' import { HttpStatusCode, VideoFile } from '@shared/models' import { @@ -15,8 +15,6 @@ import { } from '@shared/server-commands' import { checkResolutionsInMasterPlaylist, expectStartWith } from '../shared' -const expect = chai.expect - async function checkFilesInObjectStorage (files: VideoFile[], type: 'webtorrent' | 'playlist') { for (const file of files) { const shouldStartWith = type === 'webtorrent' diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts index ab4df46fc..33b6cd27c 100644 --- a/server/tests/cli/print-transcode-command.ts +++ b/server/tests/cli/print-transcode-command.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { buildAbsoluteFixturePath } from '@shared/core-utils' import { CLICommand } from '@shared/server-commands' import { VideoResolution } from '../../../shared/models/videos' -const expect = chai.expect - describe('Test print transcode jobs', function () { it('Should print the correct command for each resolution', async function () { diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 15bfb30f0..a89e17e3c 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { createFile, readdir } from 'fs-extra' import { join } from 'path' import { wait } from '@shared/core-utils' @@ -19,8 +19,6 @@ import { waitJobs } from '@shared/server-commands' -const expect = chai.expect - async function countFiles (server: PeerTubeServer, directory: string) { const files = await readdir(server.servers.buildDirectory(directory)) diff --git a/server/tests/client.ts b/server/tests/client.ts index 0cb460327..39ba5fdf6 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { omit } from '@shared/core-utils' import { Account, @@ -23,8 +23,6 @@ import { waitJobs } from '../../shared/server-commands' -const expect = chai.expect - function checkIndexTags (html: string, title: string, description: string, css: string, config: ServerConfig) { expect(html).to.contain('' + title + '') expect(html).to.contain('') diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 3a4b063bc..607e6a542 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { XMLParser, XMLValidator } from 'fast-xml-parser' import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { @@ -19,8 +19,6 @@ import { chai.use(require('chai-xml')) chai.use(require('chai-json-schema')) chai.config.includeStack = true -const expect = chai.expect - describe('Test syndication feeds', () => { let servers: PeerTubeServer[] = [] let serverHLSOnly: PeerTubeServer diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts index e1c563dee..e39cae442 100644 --- a/server/tests/helpers/comment-model.ts +++ b/server/tests/helpers/comment-model.ts @@ -1,10 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { VideoCommentModel } from '../../models/video/video-comment' -const expect = chai.expect - class CommentMock { text: string diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.ts index 4f059d982..de6ba4f82 100644 --- a/server/tests/helpers/core-utils.ts +++ b/server/tests/helpers/core-utils.ts @@ -1,14 +1,12 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { snakeCase } from 'lodash' import validator from 'validator' import { getAverageBitrate, getMaxBitrate } from '@shared/core-utils' import { VideoResolution } from '@shared/models' import { objectConverter, parseBytes, parseDurationToMs } from '../../helpers/core-utils' -const expect = chai.expect - describe('Parse Bytes', function () { it('Should pass on valid value', async function () { diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 3f6a26cf9..9e404b549 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -1,11 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' import { HttpStatusCode, VideoPrivacy } from '@shared/models' -const expect = chai.expect - describe('Test misc endpoints', function () { let server: PeerTubeServer diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e05de587d..026c7e856 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' import { cleanupTests, @@ -15,8 +15,6 @@ import { } from '@shared/server-commands' import { FIXTURE_URLS } from '../shared' -const expect = chai.expect - describe('Test plugin filter hooks', function () { let servers: PeerTubeServer[] let videoUUID: string diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts index 35d710b30..fe16bf1e6 100644 --- a/server/tests/plugins/html-injection.ts +++ b/server/tests/plugins/html-injection.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, @@ -10,8 +10,6 @@ import { setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test plugins HTML injection', function () { let server: PeerTubeServer = null let command: PluginsCommand diff --git a/server/tests/plugins/translations.ts b/server/tests/plugins/translations.ts index a76edaf44..67e4683f8 100644 --- a/server/tests/plugins/translations.ts +++ b/server/tests/plugins/translations.ts @@ -1,10 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands' -const expect = chai.expect - describe('Test plugin translations', function () { let server: PeerTubeServer let command: PluginsCommand diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts index 27e97d9c0..c388f02d1 100644 --- a/server/tests/plugins/video-constants.ts +++ b/server/tests/plugins/video-constants.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' +import { expect } from 'chai' import { cleanupTests, createSingleServer, @@ -11,8 +11,6 @@ import { } from '@shared/server-commands' import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' -const expect = chai.expect - describe('Test plugin altering video constants', function () { let server: PeerTubeServer -- 2.41.0