From fe98765624cdd6695739bda719fcb726b71c2b2a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Jan 2020 14:15:16 +0100 Subject: Add ability to skip count query --- server/tests/api/check-params/videos-filter.ts | 1 - server/tests/api/check-params/videos.ts | 6 +++++- server/tests/api/videos/single-server.ts | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index 5a5668665..811756745 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts @@ -40,7 +40,6 @@ describe('Test videos filters', function () { let server: ServerInfo let userAccessToken: string let moderatorAccessToken: string - let playlistUUID: string // --------------------------------------------------------------- diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index fa6d6f622..16ef1c505 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -75,8 +75,12 @@ describe('Test videos API validator', function () { await checkBadSortPagination(server.url, path) }) + it('Should fail with a bad skipVideos query', async function () { + await makeGetRequest({ url: server.url, path, statusCodeExpected: 200, query: { skipCount: 'toto' } }) + }) + it('Should success with the correct parameters', async function () { - await makeGetRequest({ url: server.url, path, statusCodeExpected: 200 }) + await makeGetRequest({ url: server.url, path, statusCodeExpected: 200, query: { skipCount: false } }) }) }) diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index d8f394ac7..362d6b78f 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -322,6 +322,15 @@ describe('Test a single server', function () { expect(videos[0].name).to.equal(videosListBase[5].name) }) + it('Should not have the total field', async function () { + const res = await getVideosListPagination(server.url, 5, 6, 'name', true) + + const videos = res.body.data + expect(res.body.total).to.not.exist + expect(videos.length).to.equal(1) + expect(videos[0].name).to.equal(videosListBase[5].name) + }) + it('Should list and sort by name in descending order', async function () { const res = await getVideosListSort(server.url, '-name') -- cgit v1.2.3