]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/checkParams.js
Add ability to sort videos list
[github/Chocobozzz/PeerTube.git] / server / tests / api / checkParams.js
index b63091910e37a50e38801b28236c2e4fe4b2a010..a109aba47aae22c969575103b58050ea9305cf42 100644 (file)
@@ -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 () {