diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-09 11:06:13 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-09 11:17:36 +0200 |
commit | 14d3270f363245d2c83fcc2ac109e39743b5627e (patch) | |
tree | 22a1d40675d372d53c35a4d7adf1fc1b4ceb1799 /server/tests/api/multiple-pods.ts | |
parent | aa8b6df4a51c82eb91e6fd71a090b2128098af6b (diff) | |
download | PeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.tar.gz PeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.tar.zst PeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.zip |
Change how we handle resolution
It was an enum before, now we just use video height
Diffstat (limited to 'server/tests/api/multiple-pods.ts')
-rw-r--r-- | server/tests/api/multiple-pods.ts | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/server/tests/api/multiple-pods.ts b/server/tests/api/multiple-pods.ts index 08fa73aa2..8b60ac0f4 100644 --- a/server/tests/api/multiple-pods.ts +++ b/server/tests/api/multiple-pods.ts | |||
@@ -106,8 +106,8 @@ describe('Test multiple pods', function () { | |||
106 | const file = video.files[0] | 106 | const file = video.files[0] |
107 | const magnetUri = file.magnetUri | 107 | const magnetUri = file.magnetUri |
108 | expect(file.magnetUri).to.have.lengthOf.above(2) | 108 | expect(file.magnetUri).to.have.lengthOf.above(2) |
109 | expect(file.resolution).to.equal(0) | 109 | expect(file.resolution).to.equal(720) |
110 | expect(file.resolutionLabel).to.equal('original') | 110 | expect(file.resolutionLabel).to.equal('720p') |
111 | expect(file.size).to.equal(572456) | 111 | expect(file.size).to.equal(572456) |
112 | 112 | ||
113 | if (server.url !== 'http://localhost:9001') { | 113 | if (server.url !== 'http://localhost:9001') { |
@@ -172,7 +172,7 @@ describe('Test multiple pods', function () { | |||
172 | expect(dateIsValid(video.updatedAt)).to.be.true | 172 | expect(dateIsValid(video.updatedAt)).to.be.true |
173 | expect(video.author).to.equal('root') | 173 | expect(video.author).to.equal('root') |
174 | 174 | ||
175 | expect(video.files).to.have.lengthOf(5) | 175 | expect(video.files).to.have.lengthOf(4) |
176 | 176 | ||
177 | // Check common attributes | 177 | // Check common attributes |
178 | for (const file of video.files) { | 178 | for (const file of video.files) { |
@@ -192,11 +192,6 @@ describe('Test multiple pods', function () { | |||
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | const originalFile = video.files.find(f => f.resolution === 0) | ||
196 | expect(originalFile).not.to.be.undefined | ||
197 | expect(originalFile.resolutionLabel).to.equal('original') | ||
198 | expect(originalFile.size).to.be.above(700000).and.below(720000) | ||
199 | |||
200 | const file240p = video.files.find(f => f.resolution === 240) | 195 | const file240p = video.files.find(f => f.resolution === 240) |
201 | expect(file240p).not.to.be.undefined | 196 | expect(file240p).not.to.be.undefined |
202 | expect(file240p.resolutionLabel).to.equal('240p') | 197 | expect(file240p.resolutionLabel).to.equal('240p') |
@@ -215,7 +210,7 @@ describe('Test multiple pods', function () { | |||
215 | const file720p = video.files.find(f => f.resolution === 720) | 210 | const file720p = video.files.find(f => f.resolution === 720) |
216 | expect(file720p).not.to.be.undefined | 211 | expect(file720p).not.to.be.undefined |
217 | expect(file720p.resolutionLabel).to.equal('720p') | 212 | expect(file720p.resolutionLabel).to.equal('720p') |
218 | expect(file720p.size).to.be.above(310000).and.below(320000) | 213 | expect(file720p.size).to.be.above(700000).and.below(7200000) |
219 | 214 | ||
220 | const test = await testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath) | 215 | const test = await testVideoImage(server.url, 'video_short2.webm', video.thumbnailPath) |
221 | expect(test).to.equal(true) | 216 | expect(test).to.equal(true) |
@@ -291,8 +286,8 @@ describe('Test multiple pods', function () { | |||
291 | 286 | ||
292 | const file1 = video1.files[0] | 287 | const file1 = video1.files[0] |
293 | expect(file1.magnetUri).to.have.lengthOf.above(2) | 288 | expect(file1.magnetUri).to.have.lengthOf.above(2) |
294 | expect(file1.resolution).to.equal(0) | 289 | expect(file1.resolution).to.equal(720) |
295 | expect(file1.resolutionLabel).to.equal('original') | 290 | expect(file1.resolutionLabel).to.equal('720p') |
296 | expect(file1.size).to.equal(292677) | 291 | expect(file1.size).to.equal(292677) |
297 | 292 | ||
298 | expect(video2.name).to.equal('my super name for pod 3-2') | 293 | expect(video2.name).to.equal('my super name for pod 3-2') |
@@ -316,8 +311,8 @@ describe('Test multiple pods', function () { | |||
316 | const file2 = video2.files[0] | 311 | const file2 = video2.files[0] |
317 | const magnetUri2 = file2.magnetUri | 312 | const magnetUri2 = file2.magnetUri |
318 | expect(file2.magnetUri).to.have.lengthOf.above(2) | 313 | expect(file2.magnetUri).to.have.lengthOf.above(2) |
319 | expect(file2.resolution).to.equal(0) | 314 | expect(file2.resolution).to.equal(720) |
320 | expect(file2.resolutionLabel).to.equal('original') | 315 | expect(file2.resolutionLabel).to.equal('720p') |
321 | expect(file2.size).to.equal(218910) | 316 | expect(file2.size).to.equal(218910) |
322 | 317 | ||
323 | if (server.url !== 'http://localhost:9003') { | 318 | if (server.url !== 'http://localhost:9003') { |
@@ -402,6 +397,22 @@ describe('Test multiple pods', function () { | |||
402 | expect(torrent.files.length).to.equal(1) | 397 | expect(torrent.files.length).to.equal(1) |
403 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | 398 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') |
404 | }) | 399 | }) |
400 | |||
401 | it('Should add the file 2 in 360p by asking pod 1', async function () { | ||
402 | // Yes, this could be long | ||
403 | this.timeout(200000) | ||
404 | |||
405 | const res = await getVideosList(servers[0].url) | ||
406 | |||
407 | const video = res.body.data.find(v => v.name === 'my super name for pod 2') | ||
408 | const file = video.files.find(f => f.resolution === 360) | ||
409 | expect(file).not.to.be.undefined | ||
410 | |||
411 | const torrent = await webtorrentAdd(file.magnetUri) | ||
412 | expect(torrent.files).to.be.an('array') | ||
413 | expect(torrent.files.length).to.equal(1) | ||
414 | expect(torrent.files[0].path).to.exist.and.to.not.equal('') | ||
415 | }) | ||
405 | }) | 416 | }) |
406 | 417 | ||
407 | describe('Should update video views, likes and dislikes', function () { | 418 | describe('Should update video views, likes and dislikes', function () { |
@@ -562,8 +573,8 @@ describe('Test multiple pods', function () { | |||
562 | 573 | ||
563 | const file = videoUpdated.files[0] | 574 | const file = videoUpdated.files[0] |
564 | expect(file.magnetUri).to.have.lengthOf.above(2) | 575 | expect(file.magnetUri).to.have.lengthOf.above(2) |
565 | expect(file.resolution).to.equal(0) | 576 | expect(file.resolution).to.equal(720) |
566 | expect(file.resolutionLabel).to.equal('original') | 577 | expect(file.resolutionLabel).to.equal('720p') |
567 | expect(file.size).to.equal(292677) | 578 | expect(file.size).to.equal(292677) |
568 | 579 | ||
569 | const test = await testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath) | 580 | const test = await testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath) |