From 0b16f5f2202e0c0832b5e678fadd95c64b8e8789 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 13 Mar 2019 16:03:03 +0100 Subject: Add videos playlist exist tests --- server/tests/api/check-params/video-playlists.ts | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'server/tests/api/check-params') diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 803e7afb9..4d8000dbf 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts @@ -522,6 +522,52 @@ describe('Test video playlists API validator', function () { }) }) + describe('When checking exists in playlist endpoint', function () { + const path = '/api/v1/users/me/video-playlists/videos-exist' + + it('Should fail with an unauthenticated user', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { videoIds: [ 1, 2 ] }, + statusCodeExpected: 401 + }) + }) + + it('Should fail with invalid video ids', async function () { + await makeGetRequest({ + url: server.url, + token: server.accessToken, + path, + query: { videoIds: 'toto' } + }) + + await makeGetRequest({ + url: server.url, + token: server.accessToken, + path, + query: { videoIds: [ 'toto' ] } + }) + + await makeGetRequest({ + url: server.url, + token: server.accessToken, + path, + query: { videoIds: [ 1, 'toto' ] } + }) + }) + + it('Should succeed with the correct params', async function () { + await makeGetRequest({ + url: server.url, + token: server.accessToken, + path, + query: { videoIds: [ 1, 2 ] }, + statusCodeExpected: 200 + }) + }) + }) + describe('When deleting an element in a playlist', function () { const getBase = (wrapper: any = {}) => { return Object.assign({ -- cgit v1.2.3