aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-17 15:25:58 +0200
committerChocobozzz <me@florianbigard.com>2022-08-17 15:25:58 +0200
commitbbd5aa7ead5f1554a0872963f957effc26d8c630 (patch)
treea32cad420cfabe4eab5df4e3f104fa34f734fa7d /server/tests/api
parenta85d530384761a0af833caac9b38b9834517c9fa (diff)
downloadPeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.tar.gz
PeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.tar.zst
PeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.zip
Reimplement a typed omit function
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/config.ts7
-rw-r--r--server/tests/api/check-params/live.ts6
-rw-r--r--server/tests/api/check-params/metrics.ts15
-rw-r--r--server/tests/api/check-params/users-admin.ts11
-rw-r--r--server/tests/api/check-params/users.ts6
-rw-r--r--server/tests/api/check-params/video-channels.ts12
-rw-r--r--server/tests/api/check-params/video-imports.ts16
-rw-r--r--server/tests/api/check-params/videos.ts12
-rw-r--r--server/tests/api/moderation/video-blacklist.ts8
-rw-r--r--server/tests/api/transcoding/transcoder.ts8
10 files changed, 40 insertions, 61 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index d67e51123..3415625ca 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2import { merge } from 'lodash'
3import 'mocha' 3import { omit } from '@shared/core-utils'
4import { merge, omit } from 'lodash'
5import { CustomConfig, HttpStatusCode } from '@shared/models' 4import { CustomConfig, HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
@@ -277,7 +276,7 @@ describe('Test config API validators', function () {
277 }) 276 })
278 277
279 it('Should fail if it misses a key', async function () { 278 it('Should fail if it misses a key', async function () {
280 const newUpdateParams = omit(updateParams, 'admin.email') 279 const newUpdateParams = { ...updateParams, admin: omit(updateParams.admin, [ 'email' ]) }
281 280
282 await makePutBodyRequest({ 281 await makePutBodyRequest({
283 url: server.url, 282 url: server.url,
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index b092f16f9..3f553c42b 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -1,9 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha'
4import { expect } from 'chai' 3import { expect } from 'chai'
5import { omit } from 'lodash' 4import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'
6import { buildAbsoluteFixturePath } from '@shared/core-utils'
7import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models' 5import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models'
8import { 6import {
9 cleanupTests, 7 cleanupTests,
@@ -132,7 +130,7 @@ describe('Test video lives API validator', function () {
132 }) 130 })
133 131
134 it('Should fail without a channel', async function () { 132 it('Should fail without a channel', async function () {
135 const fields = omit(baseCorrectParams, 'channelId') 133 const fields = omit(baseCorrectParams, [ 'channelId' ])
136 134
137 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 135 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
138 }) 136 })
diff --git a/server/tests/api/check-params/metrics.ts b/server/tests/api/check-params/metrics.ts
index 2d4509406..be8253217 100644
--- a/server/tests/api/check-params/metrics.ts
+++ b/server/tests/api/check-params/metrics.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import { omit } from '@shared/core-utils'
4import { omit } from 'lodash'
5import { HttpStatusCode, PlaybackMetricCreate, VideoResolution } from '@shared/models' 4import { HttpStatusCode, PlaybackMetricCreate, VideoResolution } from '@shared/models'
6import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' 5import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
7 6
@@ -66,7 +65,7 @@ describe('Test metrics API validators', function () {
66 await makePostBodyRequest({ 65 await makePostBodyRequest({
67 url: server.url, 66 url: server.url,
68 path, 67 path,
69 fields: omit(baseParams, 'playerMode') 68 fields: omit(baseParams, [ 'playerMode' ])
70 }) 69 })
71 70
72 await makePostBodyRequest({ 71 await makePostBodyRequest({
@@ -80,7 +79,7 @@ describe('Test metrics API validators', function () {
80 await makePostBodyRequest({ 79 await makePostBodyRequest({
81 url: server.url, 80 url: server.url,
82 path, 81 path,
83 fields: omit(baseParams, 'resolutionChanges') 82 fields: omit(baseParams, [ 'resolutionChanges' ])
84 }) 83 })
85 84
86 await makePostBodyRequest({ 85 await makePostBodyRequest({
@@ -98,7 +97,7 @@ describe('Test metrics API validators', function () {
98 await makePostBodyRequest({ 97 await makePostBodyRequest({
99 url: server.url, 98 url: server.url,
100 path, 99 path,
101 fields: omit(baseParams, 'errors') 100 fields: omit(baseParams, [ 'errors' ])
102 }) 101 })
103 102
104 await makePostBodyRequest({ 103 await makePostBodyRequest({
@@ -112,7 +111,7 @@ describe('Test metrics API validators', function () {
112 await makePostBodyRequest({ 111 await makePostBodyRequest({
113 url: server.url, 112 url: server.url,
114 path, 113 path,
115 fields: omit(baseParams, 'downloadedBytesP2P') 114 fields: omit(baseParams, [ 'downloadedBytesP2P' ])
116 }) 115 })
117 116
118 await makePostBodyRequest({ 117 await makePostBodyRequest({
@@ -126,7 +125,7 @@ describe('Test metrics API validators', function () {
126 await makePostBodyRequest({ 125 await makePostBodyRequest({
127 url: server.url, 126 url: server.url,
128 path, 127 path,
129 fields: omit(baseParams, 'downloadedBytesHTTP') 128 fields: omit(baseParams, [ 'downloadedBytesHTTP' ])
130 }) 129 })
131 130
132 await makePostBodyRequest({ 131 await makePostBodyRequest({
@@ -140,7 +139,7 @@ describe('Test metrics API validators', function () {
140 await makePostBodyRequest({ 139 await makePostBodyRequest({
141 url: server.url, 140 url: server.url,
142 path, 141 path,
143 fields: omit(baseParams, 'uploadedBytesP2P') 142 fields: omit(baseParams, [ 'uploadedBytesP2P' ])
144 }) 143 })
145 144
146 await makePostBodyRequest({ 145 await makePostBodyRequest({
diff --git a/server/tests/api/check-params/users-admin.ts b/server/tests/api/check-params/users-admin.ts
index 716c22556..d941ca024 100644
--- a/server/tests/api/check-params/users-admin.ts
+++ b/server/tests/api/check-params/users-admin.ts
@@ -1,8 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha'
4import { omit } from 'lodash'
5import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared' 3import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared'
4import { omit } from '@shared/core-utils'
6import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models' 5import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models'
7import { 6import {
8 cleanupTests, 7 cleanupTests,
@@ -123,7 +122,7 @@ describe('Test users admin API validators', function () {
123 }) 122 })
124 123
125 it('Should fail with a missing email', async function () { 124 it('Should fail with a missing email', async function () {
126 const fields = omit(baseCorrectParams, 'email') 125 const fields = omit(baseCorrectParams, [ 'email' ])
127 126
128 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 127 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
129 }) 128 })
@@ -223,13 +222,13 @@ describe('Test users admin API validators', function () {
223 }) 222 })
224 223
225 it('Should fail without a videoQuota', async function () { 224 it('Should fail without a videoQuota', async function () {
226 const fields = omit(baseCorrectParams, 'videoQuota') 225 const fields = omit(baseCorrectParams, [ 'videoQuota' ])
227 226
228 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 227 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
229 }) 228 })
230 229
231 it('Should fail without a videoQuotaDaily', async function () { 230 it('Should fail without a videoQuotaDaily', async function () {
232 const fields = omit(baseCorrectParams, 'videoQuotaDaily') 231 const fields = omit(baseCorrectParams, [ 'videoQuotaDaily' ])
233 232
234 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 233 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
235 }) 234 })
@@ -247,7 +246,7 @@ describe('Test users admin API validators', function () {
247 }) 246 })
248 247
249 it('Should fail without a user role', async function () { 248 it('Should fail without a user role', async function () {
250 const fields = omit(baseCorrectParams, 'role') 249 const fields = omit(baseCorrectParams, [ 'role' ])
251 250
252 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 251 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
253 }) 252 })
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 4c4f54958..7acfd8c2c 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -1,8 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import 'mocha'
4import { omit } from 'lodash'
5import { MockSmtpServer } from '@server/tests/shared' 2import { MockSmtpServer } from '@server/tests/shared'
3import { omit } from '@shared/core-utils'
6import { HttpStatusCode, UserRole } from '@shared/models' 4import { HttpStatusCode, UserRole } from '@shared/models'
7import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' 5import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
8 6
@@ -57,7 +55,7 @@ describe('Test users API validators', function () {
57 }) 55 })
58 56
59 it('Should fail with a missing email', async function () { 57 it('Should fail with a missing email', async function () {
60 const fields = omit(baseCorrectParams, 'email') 58 const fields = omit(baseCorrectParams, [ 'email' ])
61 59
62 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields }) 60 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
63 }) 61 })
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 9024126c0..1782474fd 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -1,10 +1,8 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import { expect } from 'chai'
4import * as chai from 'chai'
5import { omit } from 'lodash'
6import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' 4import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
7import { buildAbsoluteFixturePath } from '@shared/core-utils' 5import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'
8import { HttpStatusCode, VideoChannelUpdate } from '@shared/models' 6import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
9import { 7import {
10 ChannelsCommand, 8 ChannelsCommand,
@@ -18,8 +16,6 @@ import {
18 setAccessTokensToServers 16 setAccessTokensToServers
19} from '@shared/server-commands' 17} from '@shared/server-commands'
20 18
21const expect = chai.expect
22
23describe('Test video channels API validator', function () { 19describe('Test video channels API validator', function () {
24 const videoChannelPath = '/api/v1/video-channels' 20 const videoChannelPath = '/api/v1/video-channels'
25 let server: PeerTubeServer 21 let server: PeerTubeServer
@@ -121,7 +117,7 @@ describe('Test video channels API validator', function () {
121 }) 117 })
122 118
123 it('Should fail without a name', async function () { 119 it('Should fail without a name', async function () {
124 const fields = omit(baseCorrectParams, 'name') 120 const fields = omit(baseCorrectParams, [ 'name' ])
125 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 121 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
126 }) 122 })
127 123
@@ -131,7 +127,7 @@ describe('Test video channels API validator', function () {
131 }) 127 })
132 128
133 it('Should fail without a name', async function () { 129 it('Should fail without a name', async function () {
134 const fields = omit(baseCorrectParams, 'displayName') 130 const fields = omit(baseCorrectParams, [ 'displayName' ])
135 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 131 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
136 }) 132 })
137 133
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 85382b261..7f19b9ee9 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -1,9 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha'
4import { omit } from 'lodash'
5import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared' 3import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared'
6import { buildAbsoluteFixturePath } from '@shared/core-utils' 4import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'
7import { HttpStatusCode, VideoPrivacy } from '@shared/models' 5import { HttpStatusCode, VideoPrivacy } from '@shared/models'
8import { 6import {
9 cleanupTests, 7 cleanupTests,
@@ -107,7 +105,7 @@ describe('Test video imports API validator', function () {
107 }) 105 })
108 106
109 it('Should fail without a target url', async function () { 107 it('Should fail without a target url', async function () {
110 const fields = omit(baseCorrectParams, 'targetUrl') 108 const fields = omit(baseCorrectParams, [ 'targetUrl' ])
111 await makePostBodyRequest({ 109 await makePostBodyRequest({
112 url: server.url, 110 url: server.url,
113 path, 111 path,
@@ -189,7 +187,7 @@ describe('Test video imports API validator', function () {
189 }) 187 })
190 188
191 it('Should fail without a channel', async function () { 189 it('Should fail without a channel', async function () {
192 const fields = omit(baseCorrectParams, 'channelId') 190 const fields = omit(baseCorrectParams, [ 'channelId' ])
193 191
194 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 192 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
195 }) 193 })
@@ -271,7 +269,7 @@ describe('Test video imports API validator', function () {
271 }) 269 })
272 270
273 it('Should fail with an invalid torrent file', async function () { 271 it('Should fail with an invalid torrent file', async function () {
274 const fields = omit(baseCorrectParams, 'targetUrl') 272 const fields = omit(baseCorrectParams, [ 'targetUrl' ])
275 const attaches = { 273 const attaches = {
276 torrentfile: buildAbsoluteFixturePath('avatar-big.png') 274 torrentfile: buildAbsoluteFixturePath('avatar-big.png')
277 } 275 }
@@ -280,7 +278,7 @@ describe('Test video imports API validator', function () {
280 }) 278 })
281 279
282 it('Should fail with an invalid magnet URI', async function () { 280 it('Should fail with an invalid magnet URI', async function () {
283 let fields = omit(baseCorrectParams, 'targetUrl') 281 let fields = omit(baseCorrectParams, [ 'targetUrl' ])
284 fields = { ...fields, magnetUri: 'blabla' } 282 fields = { ...fields, magnetUri: 'blabla' }
285 283
286 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 284 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
@@ -339,7 +337,7 @@ describe('Test video imports API validator', function () {
339 } 337 }
340 }) 338 })
341 339
342 let fields = omit(baseCorrectParams, 'targetUrl') 340 let fields = omit(baseCorrectParams, [ 'targetUrl' ])
343 fields = { ...fields, magnetUri: FIXTURE_URLS.magnet } 341 fields = { ...fields, magnetUri: FIXTURE_URLS.magnet }
344 342
345 await makePostBodyRequest({ 343 await makePostBodyRequest({
@@ -350,7 +348,7 @@ describe('Test video imports API validator', function () {
350 expectedStatus: HttpStatusCode.CONFLICT_409 348 expectedStatus: HttpStatusCode.CONFLICT_409
351 }) 349 })
352 350
353 fields = omit(fields, 'magnetUri') 351 fields = omit(fields, [ 'magnetUri' ])
354 const attaches = { 352 const attaches = {
355 torrentfile: buildAbsoluteFixturePath('video-720p.torrent') 353 torrentfile: buildAbsoluteFixturePath('video-720p.torrent')
356 } 354 }
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index e5c9b90c4..572ca8997 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -1,11 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import { expect } from 'chai'
4import * as chai from 'chai'
5import { omit } from 'lodash'
6import { join } from 'path' 4import { join } from 'path'
7import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, checkUploadVideoParam } from '@server/tests/shared' 5import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, checkUploadVideoParam } from '@server/tests/shared'
8import { randomInt, root } from '@shared/core-utils' 6import { omit, randomInt, root } from '@shared/core-utils'
9import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' 7import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'
10import { 8import {
11 cleanupTests, 9 cleanupTests,
@@ -18,8 +16,6 @@ import {
18 setAccessTokensToServers 16 setAccessTokensToServers
19} from '@shared/server-commands' 17} from '@shared/server-commands'
20 18
21const expect = chai.expect
22
23describe('Test videos API validator', function () { 19describe('Test videos API validator', function () {
24 const path = '/api/v1/videos/' 20 const path = '/api/v1/videos/'
25 let server: PeerTubeServer 21 let server: PeerTubeServer
@@ -219,7 +215,7 @@ describe('Test videos API validator', function () {
219 }) 215 })
220 216
221 it('Should fail without name', async function () { 217 it('Should fail without name', async function () {
222 const fields = omit(baseCorrectParams, 'name') 218 const fields = omit(baseCorrectParams, [ 'name' ])
223 const attaches = baseCorrectAttaches 219 const attaches = baseCorrectAttaches
224 220
225 await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode) 221 await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
@@ -268,7 +264,7 @@ describe('Test videos API validator', function () {
268 }) 264 })
269 265
270 it('Should fail without a channel', async function () { 266 it('Should fail without a channel', async function () {
271 const fields = omit(baseCorrectParams, 'channelId') 267 const fields = omit(baseCorrectParams, [ 'channelId' ])
272 const attaches = baseCorrectAttaches 268 const attaches = baseCorrectAttaches
273 269
274 await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode) 270 await checkUploadVideoParam(server, server.accessToken, { ...fields, ...attaches }, HttpStatusCode.BAD_REQUEST_400, mode)
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index 1790210ff..a7620b071 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -2,8 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { orderBy } from 'lodash'
6import { FIXTURE_URLS } from '@server/tests/shared' 5import { FIXTURE_URLS } from '@server/tests/shared'
6import { sortObjectComparator } from '@shared/core-utils'
7import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models' 7import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'
8import { 8import {
9 BlacklistCommand, 9 BlacklistCommand,
@@ -138,7 +138,7 @@ describe('Test video blacklist', function () {
138 expect(blacklistedVideos).to.be.an('array') 138 expect(blacklistedVideos).to.be.an('array')
139 expect(blacklistedVideos.length).to.equal(2) 139 expect(blacklistedVideos.length).to.equal(2)
140 140
141 const result = orderBy(body.data, [ 'id' ], [ 'desc' ]) 141 const result = [ ...body.data ].sort(sortObjectComparator('id', 'desc'))
142 expect(blacklistedVideos).to.deep.equal(result) 142 expect(blacklistedVideos).to.deep.equal(result)
143 }) 143 })
144 144
@@ -150,7 +150,7 @@ describe('Test video blacklist', function () {
150 expect(blacklistedVideos).to.be.an('array') 150 expect(blacklistedVideos).to.be.an('array')
151 expect(blacklistedVideos.length).to.equal(2) 151 expect(blacklistedVideos.length).to.equal(2)
152 152
153 const result = orderBy(body.data, [ 'name' ], [ 'desc' ]) 153 const result = [ ...body.data ].sort(sortObjectComparator('name', 'desc'))
154 expect(blacklistedVideos).to.deep.equal(result) 154 expect(blacklistedVideos).to.deep.equal(result)
155 }) 155 })
156 156
@@ -162,7 +162,7 @@ describe('Test video blacklist', function () {
162 expect(blacklistedVideos).to.be.an('array') 162 expect(blacklistedVideos).to.be.an('array')
163 expect(blacklistedVideos.length).to.equal(2) 163 expect(blacklistedVideos.length).to.equal(2)
164 164
165 const result = orderBy(body.data, [ 'createdAt' ]) 165 const result = [ ...body.data ].sort(sortObjectComparator('createdAt', 'asc'))
166 expect(blacklistedVideos).to.deep.equal(result) 166 expect(blacklistedVideos).to.deep.equal(result)
167 }) 167 })
168 }) 168 })
diff --git a/server/tests/api/transcoding/transcoder.ts b/server/tests/api/transcoding/transcoder.ts
index 48a20e1d5..db0127805 100644
--- a/server/tests/api/transcoding/transcoder.ts
+++ b/server/tests/api/transcoding/transcoder.ts
@@ -1,11 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import { expect } from 'chai'
4import * as chai from 'chai'
5import { omit } from 'lodash'
6import { canDoQuickTranscode } from '@server/helpers/ffmpeg' 4import { canDoQuickTranscode } from '@server/helpers/ffmpeg'
7import { generateHighBitrateVideo, generateVideoWithFramerate, getAllFiles } from '@server/tests/shared' 5import { generateHighBitrateVideo, generateVideoWithFramerate, getAllFiles } from '@server/tests/shared'
8import { buildAbsoluteFixturePath, getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' 6import { buildAbsoluteFixturePath, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils'
9import { 7import {
10 buildFileMetadata, 8 buildFileMetadata,
11 getAudioStream, 9 getAudioStream,
@@ -26,8 +24,6 @@ import {
26 webtorrentAdd 24 webtorrentAdd
27} from '@shared/server-commands' 25} from '@shared/server-commands'
28 26
29const expect = chai.expect
30
31function updateConfigForTranscoding (server: PeerTubeServer) { 27function updateConfigForTranscoding (server: PeerTubeServer) {
32 return server.config.updateCustomSubConfig({ 28 return server.config.updateCustomSubConfig({
33 newConfig: { 29 newConfig: {