From a877d5acc5c52b8667c65f725bbca9a52e40ec48 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 May 2016 21:03:00 +0200 Subject: Add ability to sort videos list --- server/tests/api/checkParams.js | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'server/tests/api/checkParams.js') diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js index b63091910..a109aba47 100644 --- a/server/tests/api/checkParams.js +++ b/server/tests/api/checkParams.js @@ -130,6 +130,32 @@ describe('Test parameters validator', function () { describe('Of the videos API', function () { const path = '/api/v1/videos/' + describe('When listing a video', function () { + it('Should fail with a bad start pagination', function (done) { + request(server.url) + .get(path) + .query({ start: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) + + it('Should fail with a bad count pagination', function (done) { + request(server.url) + .get(path) + .query({ count: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) + + it('Should fail with an incorrect sort', function (done) { + request(server.url) + .get(path) + .query({ sort: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) + }) + describe('When searching a video', function () { it('Should fail with nothing', function (done) { request(server.url) @@ -137,6 +163,30 @@ describe('Test parameters validator', function () { .set('Accept', 'application/json') .expect(400, done) }) + + it('Should fail with a bad start pagination', function (done) { + request(server.url) + .get(pathUtils.join(path, 'search', 'test')) + .query({ start: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) + + it('Should fail with a bad count pagination', function (done) { + request(server.url) + .get(pathUtils.join(path, 'search', 'test')) + .query({ count: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) + + it('Should fail with an incorrect sort', function (done) { + request(server.url) + .get(pathUtils.join(path, 'search', 'test')) + .query({ sort: 'hello' }) + .set('Accept', 'application/json') + .expect(400, done) + }) }) describe('When adding a video', function () { -- cgit v1.2.3