aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r--server/tests/api/utils.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js
index 218b46157..c6430c930 100644
--- a/server/tests/api/utils.js
+++ b/server/tests/api/utils.js
@@ -291,24 +291,31 @@ function runServer (number, callback) {
291 }) 291 })
292} 292}
293 293
294function searchVideo (url, search, end) { 294function searchVideo (url, search, field, end) {
295 const path = '/api/v1/videos' 295 if (!end) {
296 end = field
297 field = null
298 }
296 299
297 request(url) 300 const path = '/api/v1/videos'
298 .get(path + '/search/' + search) 301 const req = request(url)
299 .set('Accept', 'application/json') 302 .get(path + '/search/' + search)
300 .expect(200) 303 .set('Accept', 'application/json')
301 .expect('Content-Type', /json/) 304
302 .end(end) 305 if (field) req.query({ field: field })
306 req.expect(200)
307 .expect('Content-Type', /json/)
308 .end(end)
303} 309}
304 310
305function searchVideoWithPagination (url, search, start, count, end) { 311function searchVideoWithPagination (url, search, field, start, count, end) {
306 const path = '/api/v1/videos' 312 const path = '/api/v1/videos'
307 313
308 request(url) 314 request(url)
309 .get(path + '/search/' + search) 315 .get(path + '/search/' + search)
310 .query({ start: start }) 316 .query({ start: start })
311 .query({ count: count }) 317 .query({ count: count })
318 .query({ field: field })
312 .set('Accept', 'application/json') 319 .set('Accept', 'application/json')
313 .expect(200) 320 .expect(200)
314 .expect('Content-Type', /json/) 321 .expect('Content-Type', /json/)