aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-pod.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/single-pod.js')
-rw-r--r--server/tests/api/single-pod.js52
1 files changed, 25 insertions, 27 deletions
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index 2ac83bbf4..2db60448f 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -338,69 +338,69 @@ describe('Test a single pod', function () {
338 }) 338 })
339 339
340 it('Should list only the two first videos', function (done) { 340 it('Should list only the two first videos', function (done) {
341 videosUtils.getVideosListPagination(server.url, 0, 2, function (err, res) { 341 videosUtils.getVideosListPagination(server.url, 0, 2, 'name', function (err, res) {
342 if (err) throw err 342 if (err) throw err
343 343
344 const videos = res.body.data 344 const videos = res.body.data
345 expect(res.body.total).to.equal(6) 345 expect(res.body.total).to.equal(6)
346 expect(videos.length).to.equal(2) 346 expect(videos.length).to.equal(2)
347 expect(videos[0].name === videosListBase[0].name) 347 expect(videos[0].name).to.equal(videosListBase[0].name)
348 expect(videos[1].name === videosListBase[1].name) 348 expect(videos[1].name).to.equal(videosListBase[1].name)
349 349
350 done() 350 done()
351 }) 351 })
352 }) 352 })
353 353
354 it('Should list only the next three videos', function (done) { 354 it('Should list only the next three videos', function (done) {
355 videosUtils.getVideosListPagination(server.url, 2, 3, function (err, res) { 355 videosUtils.getVideosListPagination(server.url, 2, 3, 'name', function (err, res) {
356 if (err) throw err 356 if (err) throw err
357 357
358 const videos = res.body.data 358 const videos = res.body.data
359 expect(res.body.total).to.equal(6) 359 expect(res.body.total).to.equal(6)
360 expect(videos.length).to.equal(3) 360 expect(videos.length).to.equal(3)
361 expect(videos[0].name === videosListBase[2].name) 361 expect(videos[0].name).to.equal(videosListBase[2].name)
362 expect(videos[1].name === videosListBase[3].name) 362 expect(videos[1].name).to.equal(videosListBase[3].name)
363 expect(videos[2].name === videosListBase[4].name) 363 expect(videos[2].name).to.equal(videosListBase[4].name)
364 364
365 done() 365 done()
366 }) 366 })
367 }) 367 })
368 368
369 it('Should list the last video', function (done) { 369 it('Should list the last video', function (done) {
370 videosUtils.getVideosListPagination(server.url, 5, 6, function (err, res) { 370 videosUtils.getVideosListPagination(server.url, 5, 6, 'name', function (err, res) {
371 if (err) throw err 371 if (err) throw err
372 372
373 const videos = res.body.data 373 const videos = res.body.data
374 expect(res.body.total).to.equal(6) 374 expect(res.body.total).to.equal(6)
375 expect(videos.length).to.equal(1) 375 expect(videos.length).to.equal(1)
376 expect(videos[0].name === videosListBase[5].name) 376 expect(videos[0].name).to.equal(videosListBase[5].name)
377 377
378 done() 378 done()
379 }) 379 })
380 }) 380 })
381 381
382 it('Should search the first video', function (done) { 382 it('Should search the first video', function (done) {
383 videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 0, 1, function (err, res) { 383 videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 0, 1, 'name', function (err, res) {
384 if (err) throw err 384 if (err) throw err
385 385
386 const videos = res.body.data 386 const videos = res.body.data
387 expect(res.body.total).to.equal(4) 387 expect(res.body.total).to.equal(4)
388 expect(videos.length).to.equal(1) 388 expect(videos.length).to.equal(1)
389 expect(videos[0].name === 'video_short.webm name') 389 expect(videos[0].name).to.equal('video_short1.webm name')
390 390
391 done() 391 done()
392 }) 392 })
393 }) 393 })
394 394
395 it('Should search the last two videos', function (done) { 395 it('Should search the last two videos', function (done) {
396 videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 2, 2, function (err, res) { 396 videosUtils.searchVideoWithPagination(server.url, 'webm', 'name', 2, 2, 'name', function (err, res) {
397 if (err) throw err 397 if (err) throw err
398 398
399 const videos = res.body.data 399 const videos = res.body.data
400 expect(res.body.total).to.equal(4) 400 expect(res.body.total).to.equal(4)
401 expect(videos.length).to.equal(2) 401 expect(videos.length).to.equal(2)
402 expect(videos[0].name === 'video_short2.webm name') 402 expect(videos[0].name).to.equal('video_short3.webm name')
403 expect(videos[1].name === 'video_short3.webm name') 403 expect(videos[1].name).to.equal('video_short.webm name')
404 404
405 done() 405 done()
406 }) 406 })
@@ -476,12 +476,12 @@ describe('Test a single pod', function () {
476 const videos = res.body.data 476 const videos = res.body.data
477 expect(res.body.total).to.equal(6) 477 expect(res.body.total).to.equal(6)
478 expect(videos.length).to.equal(6) 478 expect(videos.length).to.equal(6)
479 expect(videos[5].name === 'video_short.mp4 name') 479 expect(videos[0].name).to.equal('video_short.webm name')
480 expect(videos[4].name === 'video_short.ogv name') 480 expect(videos[1].name).to.equal('video_short.ogv name')
481 expect(videos[3].name === 'video_short.webm name') 481 expect(videos[2].name).to.equal('video_short.mp4 name')
482 expect(videos[2].name === 'video_short1.webm name') 482 expect(videos[3].name).to.equal('video_short3.webm name')
483 expect(videos[1].name === 'video_short2.webm name') 483 expect(videos[4].name).to.equal('video_short2.webm name')
484 expect(videos[0].name === 'video_short3.webm name') 484 expect(videos[5].name).to.equal('video_short1.webm name')
485 485
486 done() 486 done()
487 }) 487 })
@@ -495,12 +495,12 @@ describe('Test a single pod', function () {
495 expect(res.body.total).to.equal(4) 495 expect(res.body.total).to.equal(4)
496 expect(videos.length).to.equal(4) 496 expect(videos.length).to.equal(4)
497 497
498 expect(videos[0].name === 'video_short.webm name') 498 expect(videos[0].name).to.equal('video_short1.webm name')
499 expect(videos[1].name === 'video_short1.webm name') 499 expect(videos[1].name).to.equal('video_short2.webm name')
500 expect(videos[2].name === 'video_short2.webm name') 500 expect(videos[2].name).to.equal('video_short3.webm name')
501 expect(videos[3].name === 'video_short3.webm name') 501 expect(videos[3].name).to.equal('video_short.webm name')
502 502
503 videoId = videos[3].id 503 videoId = videos[2].id
504 504
505 done() 505 done()
506 }) 506 })
@@ -535,8 +535,6 @@ describe('Test a single pod', function () {
535 if (err) throw err 535 if (err) throw err
536 expect(test).to.equal(true) 536 expect(test).to.equal(true)
537 537
538 videoId = video.id
539
540 webtorrent.add(video.magnetUri, function (torrent) { 538 webtorrent.add(video.magnetUri, function (torrent) {
541 expect(torrent.files).to.exist 539 expect(torrent.files).to.exist
542 expect(torrent.files.length).to.equal(1) 540 expect(torrent.files.length).to.equal(1)