aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/multiplePods.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/multiplePods.js')
-rw-r--r--server/tests/api/multiplePods.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js
index 9fdd0f308..e8b182622 100644
--- a/server/tests/api/multiplePods.js
+++ b/server/tests/api/multiplePods.js
@@ -1,18 +1,18 @@
1'use strict' 1'use strict'
2 2
3var async = require('async') 3const async = require('async')
4var chai = require('chai') 4const chai = require('chai')
5var expect = chai.expect 5const expect = chai.expect
6var pathUtils = require('path') 6const pathUtils = require('path')
7 7
8var utils = require('./utils') 8const utils = require('./utils')
9var webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) 9const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
10webtorrent.silent = true 10webtorrent.silent = true
11 11
12describe('Test multiple pods', function () { 12describe('Test multiple pods', function () {
13 var apps = [] 13 let apps = []
14 var urls = [] 14 let urls = []
15 var to_remove = [] 15 const to_remove = []
16 16
17 before(function (done) { 17 before(function (done) {
18 this.timeout(30000) 18 this.timeout(30000)
@@ -73,15 +73,15 @@ describe('Test multiple pods', function () {
73 if (err) throw err 73 if (err) throw err
74 74
75 async.each(urls, function (url, callback) { 75 async.each(urls, function (url, callback) {
76 var base_magnet = null 76 let base_magnet = null
77 77
78 utils.getVideosList(url, function (err, res) { 78 utils.getVideosList(url, function (err, res) {
79 if (err) throw err 79 if (err) throw err
80 80
81 var videos = res.body 81 const videos = res.body
82 expect(videos).to.be.an('array') 82 expect(videos).to.be.an('array')
83 expect(videos.length).to.equal(1) 83 expect(videos.length).to.equal(1)
84 var video = videos[0] 84 const video = videos[0]
85 expect(video.name).to.equal('my super name for pod 1') 85 expect(video.name).to.equal('my super name for pod 1')
86 expect(video.description).to.equal('my super description for pod 1') 86 expect(video.description).to.equal('my super description for pod 1')
87 expect(video.podUrl).to.equal('http://localhost:9001') 87 expect(video.podUrl).to.equal('http://localhost:9001')
@@ -116,15 +116,15 @@ describe('Test multiple pods', function () {
116 if (err) throw err 116 if (err) throw err
117 117
118 async.each(urls, function (url, callback) { 118 async.each(urls, function (url, callback) {
119 var base_magnet = null 119 let base_magnet = null
120 120
121 utils.getVideosList(url, function (err, res) { 121 utils.getVideosList(url, function (err, res) {
122 if (err) throw err 122 if (err) throw err
123 123
124 var videos = res.body 124 const videos = res.body
125 expect(videos).to.be.an('array') 125 expect(videos).to.be.an('array')
126 expect(videos.length).to.equal(2) 126 expect(videos.length).to.equal(2)
127 var video = videos[1] 127 const video = videos[1]
128 expect(video.name).to.equal('my super name for pod 2') 128 expect(video.name).to.equal('my super name for pod 2')
129 expect(video.description).to.equal('my super description for pod 2') 129 expect(video.description).to.equal('my super description for pod 2')
130 expect(video.podUrl).to.equal('http://localhost:9002') 130 expect(video.podUrl).to.equal('http://localhost:9002')
@@ -160,16 +160,16 @@ describe('Test multiple pods', function () {
160 function (err) { 160 function (err) {
161 if (err) throw err 161 if (err) throw err
162 162
163 var base_magnet = null 163 let base_magnet = null
164 // All pods should have this video 164 // All pods should have this video
165 async.each(urls, function (url, callback) { 165 async.each(urls, function (url, callback) {
166 utils.getVideosList(url, function (err, res) { 166 utils.getVideosList(url, function (err, res) {
167 if (err) throw err 167 if (err) throw err
168 168
169 var videos = res.body 169 const videos = res.body
170 expect(videos).to.be.an('array') 170 expect(videos).to.be.an('array')
171 expect(videos.length).to.equal(4) 171 expect(videos.length).to.equal(4)
172 var video = videos[2] 172 let video = videos[2]
173 expect(video.name).to.equal('my super name for pod 3') 173 expect(video.name).to.equal('my super name for pod 3')
174 expect(video.description).to.equal('my super description for pod 3') 174 expect(video.description).to.equal('my super description for pod 3')
175 expect(video.podUrl).to.equal('http://localhost:9003') 175 expect(video.podUrl).to.equal('http://localhost:9003')
@@ -204,7 +204,7 @@ describe('Test multiple pods', function () {
204 utils.getVideosList(urls[2], function (err, res) { 204 utils.getVideosList(urls[2], function (err, res) {
205 if (err) throw err 205 if (err) throw err
206 206
207 var video = res.body[0] 207 const video = res.body[0]
208 to_remove.push(res.body[2]._id) 208 to_remove.push(res.body[2]._id)
209 to_remove.push(res.body[3]._id) 209 to_remove.push(res.body[3]._id)
210 210
@@ -225,7 +225,7 @@ describe('Test multiple pods', function () {
225 utils.getVideosList(urls[0], function (err, res) { 225 utils.getVideosList(urls[0], function (err, res) {
226 if (err) throw err 226 if (err) throw err
227 227
228 var video = res.body[1] 228 const video = res.body[1]
229 229
230 webtorrent.add(video.magnetUri, function (torrent) { 230 webtorrent.add(video.magnetUri, function (torrent) {
231 expect(torrent.files).to.exist 231 expect(torrent.files).to.exist
@@ -244,7 +244,7 @@ describe('Test multiple pods', function () {
244 utils.getVideosList(urls[1], function (err, res) { 244 utils.getVideosList(urls[1], function (err, res) {
245 if (err) throw err 245 if (err) throw err
246 246
247 var video = res.body[2] 247 const video = res.body[2]
248 248
249 webtorrent.add(video.magnetUri, function (torrent) { 249 webtorrent.add(video.magnetUri, function (torrent) {
250 expect(torrent.files).to.exist 250 expect(torrent.files).to.exist
@@ -263,7 +263,7 @@ describe('Test multiple pods', function () {
263 utils.getVideosList(urls[0], function (err, res) { 263 utils.getVideosList(urls[0], function (err, res) {
264 if (err) throw err 264 if (err) throw err
265 265
266 var video = res.body[3] 266 const video = res.body[3]
267 267
268 webtorrent.add(video.magnetUri, function (torrent) { 268 webtorrent.add(video.magnetUri, function (torrent) {
269 expect(torrent.files).to.exist 269 expect(torrent.files).to.exist
@@ -297,7 +297,7 @@ describe('Test multiple pods', function () {
297 utils.getVideosList(url, function (err, res) { 297 utils.getVideosList(url, function (err, res) {
298 if (err) throw err 298 if (err) throw err
299 299
300 var videos = res.body 300 const videos = res.body
301 expect(videos).to.be.an('array') 301 expect(videos).to.be.an('array')
302 expect(videos.length).to.equal(2) 302 expect(videos.length).to.equal(2)
303 expect(videos[0]._id).not.to.equal(videos[1]._id) 303 expect(videos[0]._id).not.to.equal(videos[1]._id)