diff options
Diffstat (limited to 'server/tests/api/multiple-pods.js')
-rw-r--r-- | server/tests/api/multiple-pods.js | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index 4442a7ff7..169a9f2e0 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -4,7 +4,8 @@ const chai = require('chai') | |||
4 | const each = require('async/each') | 4 | const each = require('async/each') |
5 | const expect = chai.expect | 5 | const expect = chai.expect |
6 | const series = require('async/series') | 6 | const series = require('async/series') |
7 | const webtorrent = new (require('webtorrent'))() | 7 | const WebTorrent = require('webtorrent') |
8 | const webtorrent = new WebTorrent() | ||
8 | 9 | ||
9 | const loginUtils = require('../utils/login') | 10 | const loginUtils = require('../utils/login') |
10 | const miscsUtils = require('../utils/miscs') | 11 | const miscsUtils = require('../utils/miscs') |
@@ -311,7 +312,7 @@ describe('Test multiple pods', function () { | |||
311 | expect(torrent.files.length).to.equal(1) | 312 | expect(torrent.files.length).to.equal(1) |
312 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 313 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
313 | 314 | ||
314 | done() | 315 | webtorrent.remove(video.magnetUri, done) |
315 | }) | 316 | }) |
316 | }) | 317 | }) |
317 | }) | 318 | }) |
@@ -330,7 +331,7 @@ describe('Test multiple pods', function () { | |||
330 | expect(torrent.files.length).to.equal(1) | 331 | expect(torrent.files.length).to.equal(1) |
331 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 332 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
332 | 333 | ||
333 | done() | 334 | webtorrent.remove(video.magnetUri, done) |
334 | }) | 335 | }) |
335 | }) | 336 | }) |
336 | }) | 337 | }) |
@@ -349,7 +350,7 @@ describe('Test multiple pods', function () { | |||
349 | expect(torrent.files.length).to.equal(1) | 350 | expect(torrent.files.length).to.equal(1) |
350 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 351 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
351 | 352 | ||
352 | done() | 353 | webtorrent.remove(video.magnetUri, done) |
353 | }) | 354 | }) |
354 | }) | 355 | }) |
355 | }) | 356 | }) |
@@ -368,7 +369,7 @@ describe('Test multiple pods', function () { | |||
368 | expect(torrent.files.length).to.equal(1) | 369 | expect(torrent.files.length).to.equal(1) |
369 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 370 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
370 | 371 | ||
371 | done() | 372 | webtorrent.remove(video.magnetUri, done) |
372 | }) | 373 | }) |
373 | }) | 374 | }) |
374 | }) | 375 | }) |
@@ -390,7 +391,12 @@ describe('Test multiple pods', function () { | |||
390 | }) | 391 | }) |
391 | 392 | ||
392 | it('Should have the video 3 updated on each pod', function (done) { | 393 | it('Should have the video 3 updated on each pod', function (done) { |
394 | this.timeout(200000) | ||
395 | |||
393 | each(servers, function (server, callback) { | 396 | each(servers, function (server, callback) { |
397 | // Avoid "duplicate torrent" errors | ||
398 | const webtorrent = new WebTorrent() | ||
399 | |||
394 | videosUtils.getVideosList(server.url, function (err, res) { | 400 | videosUtils.getVideosList(server.url, function (err, res) { |
395 | if (err) throw err | 401 | if (err) throw err |
396 | 402 | ||
@@ -404,7 +410,18 @@ describe('Test multiple pods', function () { | |||
404 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) | 410 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) |
405 | expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true | 411 | expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true |
406 | 412 | ||
407 | callback() | 413 | videosUtils.testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath, function (err, test) { |
414 | if (err) throw err | ||
415 | expect(test).to.equal(true) | ||
416 | |||
417 | webtorrent.add(videoUpdated.magnetUri, function (torrent) { | ||
418 | expect(torrent.files).to.exist | ||
419 | expect(torrent.files.length).to.equal(1) | ||
420 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
421 | |||
422 | webtorrent.remove(videoUpdated.magnetUri, callback) | ||
423 | }) | ||
424 | }) | ||
408 | }) | 425 | }) |
409 | }, done) | 426 | }, done) |
410 | }) | 427 | }) |