aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/checkParams.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-17 21:03:00 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-17 21:03:00 +0200
commita877d5acc5c52b8667c65f725bbca9a52e40ec48 (patch)
tree20b5dd56f71c7572360807f894e85e0ab729629f /server/tests/api/checkParams.js
parent479f229198bdfcfd3a63d02babdddaa8b2209ccb (diff)
downloadPeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.tar.gz
PeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.tar.zst
PeerTube-a877d5acc5c52b8667c65f725bbca9a52e40ec48.zip
Add ability to sort videos list
Diffstat (limited to 'server/tests/api/checkParams.js')
-rw-r--r--server/tests/api/checkParams.js50
1 files changed, 50 insertions, 0 deletions
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 () {
130 describe('Of the videos API', function () { 130 describe('Of the videos API', function () {
131 const path = '/api/v1/videos/' 131 const path = '/api/v1/videos/'
132 132
133 describe('When listing a video', function () {
134 it('Should fail with a bad start pagination', function (done) {
135 request(server.url)
136 .get(path)
137 .query({ start: 'hello' })
138 .set('Accept', 'application/json')
139 .expect(400, done)
140 })
141
142 it('Should fail with a bad count pagination', function (done) {
143 request(server.url)
144 .get(path)
145 .query({ count: 'hello' })
146 .set('Accept', 'application/json')
147 .expect(400, done)
148 })
149
150 it('Should fail with an incorrect sort', function (done) {
151 request(server.url)
152 .get(path)
153 .query({ sort: 'hello' })
154 .set('Accept', 'application/json')
155 .expect(400, done)
156 })
157 })
158
133 describe('When searching a video', function () { 159 describe('When searching a video', function () {
134 it('Should fail with nothing', function (done) { 160 it('Should fail with nothing', function (done) {
135 request(server.url) 161 request(server.url)
@@ -137,6 +163,30 @@ describe('Test parameters validator', function () {
137 .set('Accept', 'application/json') 163 .set('Accept', 'application/json')
138 .expect(400, done) 164 .expect(400, done)
139 }) 165 })
166
167 it('Should fail with a bad start pagination', function (done) {
168 request(server.url)
169 .get(pathUtils.join(path, 'search', 'test'))
170 .query({ start: 'hello' })
171 .set('Accept', 'application/json')
172 .expect(400, done)
173 })
174
175 it('Should fail with a bad count pagination', function (done) {
176 request(server.url)
177 .get(pathUtils.join(path, 'search', 'test'))
178 .query({ count: 'hello' })
179 .set('Accept', 'application/json')
180 .expect(400, done)
181 })
182
183 it('Should fail with an incorrect sort', function (done) {
184 request(server.url)
185 .get(pathUtils.join(path, 'search', 'test'))
186 .query({ sort: 'hello' })
187 .set('Accept', 'application/json')
188 .expect(400, done)
189 })
140 }) 190 })
141 191
142 describe('When adding a video', function () { 192 describe('When adding a video', function () {