From e9cb361cf51d11ef603128fb6715c103becf5123 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Jan 2021 11:37:31 +0100 Subject: Fix tests --- server/tests/api/check-params/live.ts | 8 ++++---- server/tests/api/check-params/video-imports.ts | 8 ++++---- server/tests/api/check-params/video-playlists.ts | 9 ++++++++- server/tests/api/check-params/videos.ts | 16 ++++++++-------- server/tests/fixtures/preview-big.png | Bin 0 -> 432157 bytes 5 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 server/tests/fixtures/preview-big.png (limited to 'server/tests') diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index a5493572b..c171b1f81 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts @@ -180,7 +180,7 @@ describe('Test video lives API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -189,7 +189,7 @@ describe('Test video lives API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -198,7 +198,7 @@ describe('Test video lives API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -207,7 +207,7 @@ describe('Test video lives API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 49ff96117..6de6b40c8 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -201,7 +201,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -210,7 +210,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -219,7 +219,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -228,7 +228,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 418af05d1..bbea88354 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts @@ -251,7 +251,14 @@ describe('Test video playlists API validator', function () { }) it('Should fail with an incorrect thumbnail file', async function () { - const params = getBase({ thumbnailfile: 'avatar.png' }) + const params = getBase({ thumbnailfile: 'video_short.mp4' }) + + await createVideoPlaylist(params) + await updateVideoPlaylist(getUpdate(params, playlistUUID)) + }) + + it('Should fail with a thumbnail file too big', async function () { + const params = getBase({ thumbnailfile: 'preview-big.png' }) await createVideoPlaylist(params) await updateVideoPlaylist(getUpdate(params, playlistUUID)) diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 5faba82c4..188d1835c 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -373,7 +373,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'), videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } @@ -383,7 +383,7 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'), videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } @@ -393,7 +393,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'), + previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'), videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } @@ -403,7 +403,7 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'), + previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png'), videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } @@ -581,7 +581,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ @@ -597,7 +597,7 @@ describe('Test videos API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') + thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png') } await makeUploadRequest({ @@ -613,7 +613,7 @@ describe('Test videos API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4') } await makeUploadRequest({ @@ -629,7 +629,7 @@ describe('Test videos API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png') + previewfile: join(root(), 'server', 'tests', 'fixtures', 'preview-big.png') } await makeUploadRequest({ diff --git a/server/tests/fixtures/preview-big.png b/server/tests/fixtures/preview-big.png new file mode 100644 index 000000000..612e297f1 Binary files /dev/null and b/server/tests/fixtures/preview-big.png differ -- cgit v1.2.3