From 22e7ffc7810798a0aa34145f2e06e62d6004b253 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Jul 2023 09:38:03 +0200 Subject: Fix check params tests --- server/tests/shared/videos.ts | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'server/tests/shared/videos.ts') diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts index 3f59c329f..ac24bb173 100644 --- a/server/tests/shared/videos.ts +++ b/server/tests/shared/videos.ts @@ -268,16 +268,25 @@ async function saveVideoInServers (servers: PeerTubeServer[], uuid: string) { } } -function checkUploadVideoParam ( - server: PeerTubeServer, - token: string, - attributes: Partial, - expectedStatus = HttpStatusCode.OK_200, - mode: 'legacy' | 'resumable' = 'legacy' -) { +function checkUploadVideoParam (options: { + server: PeerTubeServer + token: string + attributes: Partial + expectedStatus?: HttpStatusCode + completedExpectedStatus?: HttpStatusCode + mode?: 'legacy' | 'resumable' +}) { + const { server, token, attributes, completedExpectedStatus, expectedStatus, mode = 'legacy' } = options + return mode === 'legacy' - ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus }) - : server.videos.buildResumeUpload({ token, attributes, expectedStatus, path: '/api/v1/videos/upload-resumable' }) + ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus: expectedStatus || completedExpectedStatus }) + : server.videos.buildResumeUpload({ + token, + attributes, + expectedStatus, + completedExpectedStatus, + path: '/api/v1/videos/upload-resumable' + }) } // serverNumber starts from 1 -- cgit v1.2.3