diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:25:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:25:58 +0200 |
commit | bbd5aa7ead5f1554a0872963f957effc26d8c630 (patch) | |
tree | a32cad420cfabe4eab5df4e3f104fa34f734fa7d /server/tests/api/check-params/video-imports.ts | |
parent | a85d530384761a0af833caac9b38b9834517c9fa (diff) | |
download | PeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.tar.gz PeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.tar.zst PeerTube-bbd5aa7ead5f1554a0872963f957effc26d8c630.zip |
Reimplement a typed omit function
Diffstat (limited to 'server/tests/api/check-params/video-imports.ts')
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 16 |
1 files changed, 7 insertions, 9 deletions
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 | ||
3 | import 'mocha' | ||
4 | import { omit } from 'lodash' | ||
5 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared' | 3 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared' |
6 | import { buildAbsoluteFixturePath } from '@shared/core-utils' | 4 | import { buildAbsoluteFixturePath, omit } from '@shared/core-utils' |
7 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 5 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
8 | import { | 6 | import { |
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 | } |