diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/multiple-pods.js | 69 | ||||
-rw-r--r-- | server/tests/api/single-pod.js | 71 | ||||
-rw-r--r-- | server/tests/api/video-transcoder.js | 10 |
3 files changed, 126 insertions, 24 deletions
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index abbc2caf4..b281cc249 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -121,13 +121,21 @@ describe('Test multiple pods', function () { | |||
121 | expect(video.nsfw).to.be.ok | 121 | expect(video.nsfw).to.be.ok |
122 | expect(video.description).to.equal('my super description for pod 1') | 122 | expect(video.description).to.equal('my super description for pod 1') |
123 | expect(video.podHost).to.equal('localhost:9001') | 123 | expect(video.podHost).to.equal('localhost:9001') |
124 | expect(video.magnetUri).to.exist | ||
125 | expect(video.duration).to.equal(10) | 124 | expect(video.duration).to.equal(10) |
126 | expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) | 125 | expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) |
127 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 126 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
128 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 127 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
129 | expect(video.author).to.equal('root') | 128 | expect(video.author).to.equal('root') |
130 | 129 | ||
130 | expect(video.files).to.have.lengthOf(1) | ||
131 | |||
132 | const file = video.files[0] | ||
133 | const magnetUri = file.magnetUri | ||
134 | expect(file.magnetUri).to.exist | ||
135 | expect(file.resolution).to.equal(0) | ||
136 | expect(file.resolutionLabel).to.equal('original') | ||
137 | expect(file.size).to.equal(572456) | ||
138 | |||
131 | if (server.url !== 'http://localhost:9001') { | 139 | if (server.url !== 'http://localhost:9001') { |
132 | expect(video.isLocal).to.be.false | 140 | expect(video.isLocal).to.be.false |
133 | } else { | 141 | } else { |
@@ -136,9 +144,9 @@ describe('Test multiple pods', function () { | |||
136 | 144 | ||
137 | // All pods should have the same magnet Uri | 145 | // All pods should have the same magnet Uri |
138 | if (baseMagnet === null) { | 146 | if (baseMagnet === null) { |
139 | baseMagnet = video.magnetUri | 147 | baseMagnet = magnetUri |
140 | } else { | 148 | } else { |
141 | expect(video.magnetUri).to.equal.magnetUri | 149 | expect(baseMagnet).to.equal(magnetUri) |
142 | } | 150 | } |
143 | 151 | ||
144 | videosUtils.testVideoImage(server.url, 'video_short1.webm', video.thumbnailPath, function (err, test) { | 152 | videosUtils.testVideoImage(server.url, 'video_short1.webm', video.thumbnailPath, function (err, test) { |
@@ -198,13 +206,21 @@ describe('Test multiple pods', function () { | |||
198 | expect(video.nsfw).to.be.true | 206 | expect(video.nsfw).to.be.true |
199 | expect(video.description).to.equal('my super description for pod 2') | 207 | expect(video.description).to.equal('my super description for pod 2') |
200 | expect(video.podHost).to.equal('localhost:9002') | 208 | expect(video.podHost).to.equal('localhost:9002') |
201 | expect(video.magnetUri).to.exist | ||
202 | expect(video.duration).to.equal(5) | 209 | expect(video.duration).to.equal(5) |
203 | expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) | 210 | expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) |
204 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 211 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
205 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 212 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
206 | expect(video.author).to.equal('root') | 213 | expect(video.author).to.equal('root') |
207 | 214 | ||
215 | expect(video.files).to.have.lengthOf(1) | ||
216 | |||
217 | const file = video.files[0] | ||
218 | const magnetUri = file.magnetUri | ||
219 | expect(file.magnetUri).to.exist | ||
220 | expect(file.resolution).to.equal(0) | ||
221 | expect(file.resolutionLabel).to.equal('original') | ||
222 | expect(file.size).to.equal(942961) | ||
223 | |||
208 | if (server.url !== 'http://localhost:9002') { | 224 | if (server.url !== 'http://localhost:9002') { |
209 | expect(video.isLocal).to.be.false | 225 | expect(video.isLocal).to.be.false |
210 | } else { | 226 | } else { |
@@ -213,9 +229,9 @@ describe('Test multiple pods', function () { | |||
213 | 229 | ||
214 | // All pods should have the same magnet Uri | 230 | // All pods should have the same magnet Uri |
215 | if (baseMagnet === null) { | 231 | if (baseMagnet === null) { |
216 | baseMagnet = video.magnetUri | 232 | baseMagnet = magnetUri |
217 | } else { | 233 | } else { |
218 | expect(video.magnetUri).to.equal.magnetUri | 234 | expect(baseMagnet).to.equal(magnetUri) |
219 | } | 235 | } |
220 | 236 | ||
221 | videosUtils.testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath, function (err, test) { | 237 | videosUtils.testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath, function (err, test) { |
@@ -297,13 +313,21 @@ describe('Test multiple pods', function () { | |||
297 | expect(video1.nsfw).to.be.ok | 313 | expect(video1.nsfw).to.be.ok |
298 | expect(video1.description).to.equal('my super description for pod 3') | 314 | expect(video1.description).to.equal('my super description for pod 3') |
299 | expect(video1.podHost).to.equal('localhost:9003') | 315 | expect(video1.podHost).to.equal('localhost:9003') |
300 | expect(video1.magnetUri).to.exist | ||
301 | expect(video1.duration).to.equal(5) | 316 | expect(video1.duration).to.equal(5) |
302 | expect(video1.tags).to.deep.equal([ 'tag1p3' ]) | 317 | expect(video1.tags).to.deep.equal([ 'tag1p3' ]) |
303 | expect(video1.author).to.equal('root') | 318 | expect(video1.author).to.equal('root') |
304 | expect(miscsUtils.dateIsValid(video1.createdAt)).to.be.true | 319 | expect(miscsUtils.dateIsValid(video1.createdAt)).to.be.true |
305 | expect(miscsUtils.dateIsValid(video1.updatedAt)).to.be.true | 320 | expect(miscsUtils.dateIsValid(video1.updatedAt)).to.be.true |
306 | 321 | ||
322 | expect(video1.files).to.have.lengthOf(1) | ||
323 | |||
324 | const file1 = video1.files[0] | ||
325 | const magnetUri1 = file1.magnetUri | ||
326 | expect(file1.magnetUri).to.exist | ||
327 | expect(file1.resolution).to.equal(0) | ||
328 | expect(file1.resolutionLabel).to.equal('original') | ||
329 | expect(file1.size).to.equal(292677) | ||
330 | |||
307 | expect(video2.name).to.equal('my super name for pod 3-2') | 331 | expect(video2.name).to.equal('my super name for pod 3-2') |
308 | expect(video2.category).to.equal(7) | 332 | expect(video2.category).to.equal(7) |
309 | expect(video2.categoryLabel).to.equal('Gaming') | 333 | expect(video2.categoryLabel).to.equal('Gaming') |
@@ -314,13 +338,21 @@ describe('Test multiple pods', function () { | |||
314 | expect(video2.nsfw).to.be.false | 338 | expect(video2.nsfw).to.be.false |
315 | expect(video2.description).to.equal('my super description for pod 3-2') | 339 | expect(video2.description).to.equal('my super description for pod 3-2') |
316 | expect(video2.podHost).to.equal('localhost:9003') | 340 | expect(video2.podHost).to.equal('localhost:9003') |
317 | expect(video2.magnetUri).to.exist | ||
318 | expect(video2.duration).to.equal(5) | 341 | expect(video2.duration).to.equal(5) |
319 | expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) | 342 | expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) |
320 | expect(video2.author).to.equal('root') | 343 | expect(video2.author).to.equal('root') |
321 | expect(miscsUtils.dateIsValid(video2.createdAt)).to.be.true | 344 | expect(miscsUtils.dateIsValid(video2.createdAt)).to.be.true |
322 | expect(miscsUtils.dateIsValid(video2.updatedAt)).to.be.true | 345 | expect(miscsUtils.dateIsValid(video2.updatedAt)).to.be.true |
323 | 346 | ||
347 | expect(video2.files).to.have.lengthOf(1) | ||
348 | |||
349 | const file2 = video2.files[0] | ||
350 | const magnetUri2 = file2.magnetUri | ||
351 | expect(file2.magnetUri).to.exist | ||
352 | expect(file2.resolution).to.equal(0) | ||
353 | expect(file2.resolutionLabel).to.equal('original') | ||
354 | expect(file2.size).to.equal(218910) | ||
355 | |||
324 | if (server.url !== 'http://localhost:9003') { | 356 | if (server.url !== 'http://localhost:9003') { |
325 | expect(video1.isLocal).to.be.false | 357 | expect(video1.isLocal).to.be.false |
326 | expect(video2.isLocal).to.be.false | 358 | expect(video2.isLocal).to.be.false |
@@ -331,9 +363,9 @@ describe('Test multiple pods', function () { | |||
331 | 363 | ||
332 | // All pods should have the same magnet Uri | 364 | // All pods should have the same magnet Uri |
333 | if (baseMagnet === null) { | 365 | if (baseMagnet === null) { |
334 | baseMagnet = video2.magnetUri | 366 | baseMagnet = magnetUri2 |
335 | } else { | 367 | } else { |
336 | expect(video2.magnetUri).to.equal.magnetUri | 368 | expect(baseMagnet).to.equal(magnetUri2) |
337 | } | 369 | } |
338 | 370 | ||
339 | videosUtils.testVideoImage(server.url, 'video_short3.webm', video1.thumbnailPath, function (err, test) { | 371 | videosUtils.testVideoImage(server.url, 'video_short3.webm', video1.thumbnailPath, function (err, test) { |
@@ -366,7 +398,7 @@ describe('Test multiple pods', function () { | |||
366 | toRemove.push(res.body.data[2]) | 398 | toRemove.push(res.body.data[2]) |
367 | toRemove.push(res.body.data[3]) | 399 | toRemove.push(res.body.data[3]) |
368 | 400 | ||
369 | webtorrent.add(video.magnetUri, function (torrent) { | 401 | webtorrent.add(video.files[0].magnetUri, function (torrent) { |
370 | expect(torrent.files).to.exist | 402 | expect(torrent.files).to.exist |
371 | expect(torrent.files.length).to.equal(1) | 403 | expect(torrent.files.length).to.equal(1) |
372 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 404 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -385,7 +417,7 @@ describe('Test multiple pods', function () { | |||
385 | 417 | ||
386 | const video = res.body.data[1] | 418 | const video = res.body.data[1] |
387 | 419 | ||
388 | webtorrent.add(video.magnetUri, function (torrent) { | 420 | webtorrent.add(video.files[0].magnetUri, function (torrent) { |
389 | expect(torrent.files).to.exist | 421 | expect(torrent.files).to.exist |
390 | expect(torrent.files.length).to.equal(1) | 422 | expect(torrent.files.length).to.equal(1) |
391 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 423 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -404,7 +436,7 @@ describe('Test multiple pods', function () { | |||
404 | 436 | ||
405 | const video = res.body.data[2] | 437 | const video = res.body.data[2] |
406 | 438 | ||
407 | webtorrent.add(video.magnetUri, function (torrent) { | 439 | webtorrent.add(video.files[0].magnetUri, function (torrent) { |
408 | expect(torrent.files).to.exist | 440 | expect(torrent.files).to.exist |
409 | expect(torrent.files.length).to.equal(1) | 441 | expect(torrent.files.length).to.equal(1) |
410 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 442 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -423,7 +455,7 @@ describe('Test multiple pods', function () { | |||
423 | 455 | ||
424 | const video = res.body.data[3] | 456 | const video = res.body.data[3] |
425 | 457 | ||
426 | webtorrent.add(video.magnetUri, function (torrent) { | 458 | webtorrent.add(video.files[0].magnetUri, function (torrent) { |
427 | expect(torrent.files).to.exist | 459 | expect(torrent.files).to.exist |
428 | expect(torrent.files.length).to.equal(1) | 460 | expect(torrent.files.length).to.equal(1) |
429 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 461 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -700,11 +732,18 @@ describe('Test multiple pods', function () { | |||
700 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) | 732 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) |
701 | expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true | 733 | expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true |
702 | 734 | ||
735 | const file = videoUpdated.files[0] | ||
736 | const magnetUri = file.magnetUri | ||
737 | expect(file.magnetUri).to.exist | ||
738 | expect(file.resolution).to.equal(0) | ||
739 | expect(file.resolutionLabel).to.equal('original') | ||
740 | expect(file.size).to.equal(292677) | ||
741 | |||
703 | videosUtils.testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath, function (err, test) { | 742 | videosUtils.testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath, function (err, test) { |
704 | if (err) throw err | 743 | if (err) throw err |
705 | expect(test).to.equal(true) | 744 | expect(test).to.equal(true) |
706 | 745 | ||
707 | webtorrent.add(videoUpdated.magnetUri, function (torrent) { | 746 | webtorrent.add(videoUpdated.files[0].magnetUri, function (torrent) { |
708 | expect(torrent.files).to.exist | 747 | expect(torrent.files).to.exist |
709 | expect(torrent.files.length).to.equal(1) | 748 | expect(torrent.files.length).to.equal(1) |
710 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 749 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index 1258e7e55..6933d18dd 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -129,13 +129,21 @@ describe('Test a single pod', function () { | |||
129 | expect(video.nsfw).to.be.ok | 129 | expect(video.nsfw).to.be.ok |
130 | expect(video.description).to.equal('my super description') | 130 | expect(video.description).to.equal('my super description') |
131 | expect(video.podHost).to.equal('localhost:9001') | 131 | expect(video.podHost).to.equal('localhost:9001') |
132 | expect(video.magnetUri).to.exist | ||
133 | expect(video.author).to.equal('root') | 132 | expect(video.author).to.equal('root') |
134 | expect(video.isLocal).to.be.true | 133 | expect(video.isLocal).to.be.true |
135 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) | 134 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) |
136 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 135 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
137 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 136 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
138 | 137 | ||
138 | expect(video.files).to.have.lengthOf(1) | ||
139 | |||
140 | const file = video.files[0] | ||
141 | const magnetUri = file.magnetUri | ||
142 | expect(file.magnetUri).to.exist | ||
143 | expect(file.resolution).to.equal(0) | ||
144 | expect(file.resolutionLabel).to.equal('original') | ||
145 | expect(file.size).to.equal(218910) | ||
146 | |||
139 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { | 147 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { |
140 | if (err) throw err | 148 | if (err) throw err |
141 | expect(test).to.equal(true) | 149 | expect(test).to.equal(true) |
@@ -143,7 +151,7 @@ describe('Test a single pod', function () { | |||
143 | videoId = video.id | 151 | videoId = video.id |
144 | videoUUID = video.uuid | 152 | videoUUID = video.uuid |
145 | 153 | ||
146 | webtorrent.add(video.magnetUri, function (torrent) { | 154 | webtorrent.add(magnetUri, function (torrent) { |
147 | expect(torrent.files).to.exist | 155 | expect(torrent.files).to.exist |
148 | expect(torrent.files.length).to.equal(1) | 156 | expect(torrent.files.length).to.equal(1) |
149 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 157 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -172,13 +180,21 @@ describe('Test a single pod', function () { | |||
172 | expect(video.nsfw).to.be.ok | 180 | expect(video.nsfw).to.be.ok |
173 | expect(video.description).to.equal('my super description') | 181 | expect(video.description).to.equal('my super description') |
174 | expect(video.podHost).to.equal('localhost:9001') | 182 | expect(video.podHost).to.equal('localhost:9001') |
175 | expect(video.magnetUri).to.exist | ||
176 | expect(video.author).to.equal('root') | 183 | expect(video.author).to.equal('root') |
177 | expect(video.isLocal).to.be.true | 184 | expect(video.isLocal).to.be.true |
178 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) | 185 | expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) |
179 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 186 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
180 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 187 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
181 | 188 | ||
189 | expect(video.files).to.have.lengthOf(1) | ||
190 | |||
191 | const file = video.files[0] | ||
192 | const magnetUri = file.magnetUri | ||
193 | expect(file.magnetUri).to.exist | ||
194 | expect(file.resolution).to.equal(0) | ||
195 | expect(file.resolutionLabel).to.equal('original') | ||
196 | expect(file.size).to.equal(218910) | ||
197 | |||
182 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { | 198 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { |
183 | if (err) throw err | 199 | if (err) throw err |
184 | expect(test).to.equal(true) | 200 | expect(test).to.equal(true) |
@@ -240,6 +256,15 @@ describe('Test a single pod', function () { | |||
240 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 256 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
241 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 257 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
242 | 258 | ||
259 | expect(video.files).to.have.lengthOf(1) | ||
260 | |||
261 | const file = video.files[0] | ||
262 | const magnetUri = file.magnetUri | ||
263 | expect(file.magnetUri).to.exist | ||
264 | expect(file.resolution).to.equal(0) | ||
265 | expect(file.resolutionLabel).to.equal('original') | ||
266 | expect(file.size).to.equal(218910) | ||
267 | |||
243 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { | 268 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { |
244 | if (err) throw err | 269 | if (err) throw err |
245 | expect(test).to.equal(true) | 270 | expect(test).to.equal(true) |
@@ -302,6 +327,15 @@ describe('Test a single pod', function () { | |||
302 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 327 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
303 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 328 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
304 | 329 | ||
330 | expect(video.files).to.have.lengthOf(1) | ||
331 | |||
332 | const file = video.files[0] | ||
333 | const magnetUri = file.magnetUri | ||
334 | expect(file.magnetUri).to.exist | ||
335 | expect(file.resolution).to.equal(0) | ||
336 | expect(file.resolutionLabel).to.equal('original') | ||
337 | expect(file.size).to.equal(218910) | ||
338 | |||
305 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { | 339 | videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { |
306 | if (err) throw err | 340 | if (err) throw err |
307 | expect(test).to.equal(true) | 341 | expect(test).to.equal(true) |
@@ -564,7 +598,7 @@ describe('Test a single pod', function () { | |||
564 | 598 | ||
565 | it('Should search the right magnetUri video', function (done) { | 599 | it('Should search the right magnetUri video', function (done) { |
566 | const video = videosListBase[0] | 600 | const video = videosListBase[0] |
567 | videosUtils.searchVideoWithPagination(server.url, encodeURIComponent(video.magnetUri), 'magnetUri', 0, 15, function (err, res) { | 601 | videosUtils.searchVideoWithPagination(server.url, encodeURIComponent(video.files[0].magnetUri), 'magnetUri', 0, 15, function (err, res) { |
568 | if (err) throw err | 602 | if (err) throw err |
569 | 603 | ||
570 | const videos = res.body.data | 604 | const videos = res.body.data |
@@ -650,11 +684,20 @@ describe('Test a single pod', function () { | |||
650 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 684 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
651 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 685 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
652 | 686 | ||
687 | expect(video.files).to.have.lengthOf(1) | ||
688 | |||
689 | const file = video.files[0] | ||
690 | const magnetUri = file.magnetUri | ||
691 | expect(file.magnetUri).to.exist | ||
692 | expect(file.resolution).to.equal(0) | ||
693 | expect(file.resolutionLabel).to.equal('original') | ||
694 | expect(file.size).to.equal(292677) | ||
695 | |||
653 | videosUtils.testVideoImage(server.url, 'video_short3.webm', video.thumbnailPath, function (err, test) { | 696 | videosUtils.testVideoImage(server.url, 'video_short3.webm', video.thumbnailPath, function (err, test) { |
654 | if (err) throw err | 697 | if (err) throw err |
655 | expect(test).to.equal(true) | 698 | expect(test).to.equal(true) |
656 | 699 | ||
657 | webtorrent.add(video.magnetUri, function (torrent) { | 700 | webtorrent.add(magnetUri, function (torrent) { |
658 | expect(torrent.files).to.exist | 701 | expect(torrent.files).to.exist |
659 | expect(torrent.files.length).to.equal(1) | 702 | expect(torrent.files.length).to.equal(1) |
660 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 703 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
@@ -694,6 +737,15 @@ describe('Test a single pod', function () { | |||
694 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 737 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
695 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 738 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
696 | 739 | ||
740 | expect(video.files).to.have.lengthOf(1) | ||
741 | |||
742 | const file = video.files[0] | ||
743 | const magnetUri = file.magnetUri | ||
744 | expect(file.magnetUri).to.exist | ||
745 | expect(file.resolution).to.equal(0) | ||
746 | expect(file.resolutionLabel).to.equal('original') | ||
747 | expect(file.size).to.equal(292677) | ||
748 | |||
697 | done() | 749 | done() |
698 | }) | 750 | }) |
699 | }) | 751 | }) |
@@ -728,6 +780,15 @@ describe('Test a single pod', function () { | |||
728 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true | 780 | expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true |
729 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true | 781 | expect(miscsUtils.dateIsValid(video.updatedAt)).to.be.true |
730 | 782 | ||
783 | expect(video.files).to.have.lengthOf(1) | ||
784 | |||
785 | const file = video.files[0] | ||
786 | const magnetUri = file.magnetUri | ||
787 | expect(file.magnetUri).to.exist | ||
788 | expect(file.resolution).to.equal(0) | ||
789 | expect(file.resolutionLabel).to.equal('original') | ||
790 | expect(file.size).to.equal(292677) | ||
791 | |||
731 | done() | 792 | done() |
732 | }) | 793 | }) |
733 | }) | 794 | }) |
diff --git a/server/tests/api/video-transcoder.js b/server/tests/api/video-transcoder.js index c0b597668..c7af3cf11 100644 --- a/server/tests/api/video-transcoder.js +++ b/server/tests/api/video-transcoder.js | |||
@@ -56,9 +56,10 @@ describe('Test video transcoding', function () { | |||
56 | if (err) throw err | 56 | if (err) throw err |
57 | 57 | ||
58 | const video = res.body.data[0] | 58 | const video = res.body.data[0] |
59 | expect(video.magnetUri).to.match(/\.webm/) | 59 | const magnetUri = video.files[0].magnetUri |
60 | expect(magnetUri).to.match(/\.webm/) | ||
60 | 61 | ||
61 | webtorrent.add(video.magnetUri, function (torrent) { | 62 | webtorrent.add(magnetUri, function (torrent) { |
62 | expect(torrent.files).to.exist | 63 | expect(torrent.files).to.exist |
63 | expect(torrent.files.length).to.equal(1) | 64 | expect(torrent.files.length).to.equal(1) |
64 | expect(torrent.files[0].path).match(/\.webm$/) | 65 | expect(torrent.files[0].path).match(/\.webm$/) |
@@ -86,9 +87,10 @@ describe('Test video transcoding', function () { | |||
86 | if (err) throw err | 87 | if (err) throw err |
87 | 88 | ||
88 | const video = res.body.data[0] | 89 | const video = res.body.data[0] |
89 | expect(video.magnetUri).to.match(/\.mp4/) | 90 | const magnetUri = video.files[0].magnetUri |
91 | expect(magnetUri).to.match(/\.mp4/) | ||
90 | 92 | ||
91 | webtorrent.add(video.magnetUri, function (torrent) { | 93 | webtorrent.add(magnetUri, function (torrent) { |
92 | expect(torrent.files).to.exist | 94 | expect(torrent.files).to.exist |
93 | expect(torrent.files.length).to.equal(1) | 95 | expect(torrent.files.length).to.equal(1) |
94 | expect(torrent.files[0].path).match(/\.mp4$/) | 96 | expect(torrent.files[0].path).match(/\.mp4$/) |