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.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js
index c31c18b02..dac6dd410 100644
--- a/server/tests/api/multiplePods.js
+++ b/server/tests/api/multiplePods.js
@@ -60,8 +60,9 @@ describe('Test multiple pods', function () {
60 utils.getVideosList(server.url, function (err, res) { 60 utils.getVideosList(server.url, function (err, res) {
61 if (err) throw err 61 if (err) throw err
62 62
63 expect(res.body).to.be.an('array') 63 const videos = res.body.data
64 expect(res.body.length).to.equal(0) 64 expect(videos).to.be.an('array')
65 expect(videos.length).to.equal(0)
65 66
66 callback() 67 callback()
67 }) 68 })
@@ -89,13 +90,13 @@ describe('Test multiple pods', function () {
89 utils.getVideosList(server.url, function (err, res) { 90 utils.getVideosList(server.url, function (err, res) {
90 if (err) throw err 91 if (err) throw err
91 92
92 const videos = res.body 93 const videos = res.body.data
93 expect(videos).to.be.an('array') 94 expect(videos).to.be.an('array')
94 expect(videos.length).to.equal(1) 95 expect(videos.length).to.equal(1)
95 const video = videos[0] 96 const video = videos[0]
96 expect(video.name).to.equal('my super name for pod 1') 97 expect(video.name).to.equal('my super name for pod 1')
97 expect(video.description).to.equal('my super description for pod 1') 98 expect(video.description).to.equal('my super description for pod 1')
98 expect(video.podUrl).to.equal('http://localhost:9001') 99 expect(video.podUrl).to.equal('localhost:9001')
99 expect(video.magnetUri).to.exist 100 expect(video.magnetUri).to.exist
100 expect(video.duration).to.equal(10) 101 expect(video.duration).to.equal(10)
101 expect(utils.dateIsValid(video.createdDate)).to.be.true 102 expect(utils.dateIsValid(video.createdDate)).to.be.true
@@ -145,13 +146,13 @@ describe('Test multiple pods', function () {
145 utils.getVideosList(server.url, function (err, res) { 146 utils.getVideosList(server.url, function (err, res) {
146 if (err) throw err 147 if (err) throw err
147 148
148 const videos = res.body 149 const videos = res.body.data
149 expect(videos).to.be.an('array') 150 expect(videos).to.be.an('array')
150 expect(videos.length).to.equal(2) 151 expect(videos.length).to.equal(2)
151 const video = videos[1] 152 const video = videos[1]
152 expect(video.name).to.equal('my super name for pod 2') 153 expect(video.name).to.equal('my super name for pod 2')
153 expect(video.description).to.equal('my super description for pod 2') 154 expect(video.description).to.equal('my super description for pod 2')
154 expect(video.podUrl).to.equal('http://localhost:9002') 155 expect(video.podUrl).to.equal('localhost:9002')
155 expect(video.magnetUri).to.exist 156 expect(video.magnetUri).to.exist
156 expect(video.duration).to.equal(5) 157 expect(video.duration).to.equal(5)
157 expect(utils.dateIsValid(video.createdDate)).to.be.true 158 expect(utils.dateIsValid(video.createdDate)).to.be.true
@@ -203,7 +204,7 @@ describe('Test multiple pods', function () {
203 utils.getVideosList(server.url, function (err, res) { 204 utils.getVideosList(server.url, function (err, res) {
204 if (err) throw err 205 if (err) throw err
205 206
206 const videos = res.body 207 const videos = res.body.data
207 expect(videos).to.be.an('array') 208 expect(videos).to.be.an('array')
208 expect(videos.length).to.equal(4) 209 expect(videos.length).to.equal(4)
209 210
@@ -220,14 +221,14 @@ describe('Test multiple pods', function () {
220 221
221 expect(video1.name).to.equal('my super name for pod 3') 222 expect(video1.name).to.equal('my super name for pod 3')
222 expect(video1.description).to.equal('my super description for pod 3') 223 expect(video1.description).to.equal('my super description for pod 3')
223 expect(video1.podUrl).to.equal('http://localhost:9003') 224 expect(video1.podUrl).to.equal('localhost:9003')
224 expect(video1.magnetUri).to.exist 225 expect(video1.magnetUri).to.exist
225 expect(video1.duration).to.equal(5) 226 expect(video1.duration).to.equal(5)
226 expect(utils.dateIsValid(video1.createdDate)).to.be.true 227 expect(utils.dateIsValid(video1.createdDate)).to.be.true
227 228
228 expect(video2.name).to.equal('my super name for pod 3-2') 229 expect(video2.name).to.equal('my super name for pod 3-2')
229 expect(video2.description).to.equal('my super description for pod 3-2') 230 expect(video2.description).to.equal('my super description for pod 3-2')
230 expect(video2.podUrl).to.equal('http://localhost:9003') 231 expect(video2.podUrl).to.equal('localhost:9003')
231 expect(video2.magnetUri).to.exist 232 expect(video2.magnetUri).to.exist
232 expect(video2.duration).to.equal(5) 233 expect(video2.duration).to.equal(5)
233 expect(utils.dateIsValid(video2.createdDate)).to.be.true 234 expect(utils.dateIsValid(video2.createdDate)).to.be.true
@@ -273,9 +274,9 @@ describe('Test multiple pods', function () {
273 utils.getVideosList(servers[2].url, function (err, res) { 274 utils.getVideosList(servers[2].url, function (err, res) {
274 if (err) throw err 275 if (err) throw err
275 276
276 const video = res.body[0] 277 const video = res.body.data[0]
277 toRemove.push(res.body[2].id) 278 toRemove.push(res.body.data[2].id)
278 toRemove.push(res.body[3].id) 279 toRemove.push(res.body.data[3].id)
279 280
280 webtorrent.add(video.magnetUri, function (torrent) { 281 webtorrent.add(video.magnetUri, function (torrent) {
281 expect(torrent.files).to.exist 282 expect(torrent.files).to.exist
@@ -294,7 +295,7 @@ describe('Test multiple pods', function () {
294 utils.getVideosList(servers[0].url, function (err, res) { 295 utils.getVideosList(servers[0].url, function (err, res) {
295 if (err) throw err 296 if (err) throw err
296 297
297 const video = res.body[1] 298 const video = res.body.data[1]
298 299
299 webtorrent.add(video.magnetUri, function (torrent) { 300 webtorrent.add(video.magnetUri, function (torrent) {
300 expect(torrent.files).to.exist 301 expect(torrent.files).to.exist
@@ -313,7 +314,7 @@ describe('Test multiple pods', function () {
313 utils.getVideosList(servers[1].url, function (err, res) { 314 utils.getVideosList(servers[1].url, function (err, res) {
314 if (err) throw err 315 if (err) throw err
315 316
316 const video = res.body[2] 317 const video = res.body.data[2]
317 318
318 webtorrent.add(video.magnetUri, function (torrent) { 319 webtorrent.add(video.magnetUri, function (torrent) {
319 expect(torrent.files).to.exist 320 expect(torrent.files).to.exist
@@ -332,7 +333,7 @@ describe('Test multiple pods', function () {
332 utils.getVideosList(servers[0].url, function (err, res) { 333 utils.getVideosList(servers[0].url, function (err, res) {
333 if (err) throw err 334 if (err) throw err
334 335
335 const video = res.body[3] 336 const video = res.body.data[3]
336 337
337 webtorrent.add(video.magnetUri, function (torrent) { 338 webtorrent.add(video.magnetUri, function (torrent) {
338 expect(torrent.files).to.exist 339 expect(torrent.files).to.exist
@@ -366,7 +367,7 @@ describe('Test multiple pods', function () {
366 utils.getVideosList(server.url, function (err, res) { 367 utils.getVideosList(server.url, function (err, res) {
367 if (err) throw err 368 if (err) throw err
368 369
369 const videos = res.body 370 const videos = res.body.data
370 expect(videos).to.be.an('array') 371 expect(videos).to.be.an('array')
371 expect(videos.length).to.equal(2) 372 expect(videos.length).to.equal(2)
372 expect(videos[0].id).not.to.equal(videos[1].id) 373 expect(videos[0].id).not.to.equal(videos[1].id)