aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-pod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/single-pod.ts')
-rw-r--r--server/tests/api/single-pod.ts63
1 files changed, 36 insertions, 27 deletions
diff --git a/server/tests/api/single-pod.ts b/server/tests/api/single-pod.ts
index 71017b2b3..d3a982436 100644
--- a/server/tests/api/single-pod.ts
+++ b/server/tests/api/single-pod.ts
@@ -122,22 +122,25 @@ describe('Test a single pod', function () {
122 expect(dateIsValid(video.createdAt)).to.be.true 122 expect(dateIsValid(video.createdAt)).to.be.true
123 expect(dateIsValid(video.updatedAt)).to.be.true 123 expect(dateIsValid(video.updatedAt)).to.be.true
124 124
125 expect(video.files).to.have.lengthOf(1) 125 const res2 = await getVideo(server.url, res.body.data[0].id)
126 const videoDetails = res2.body
126 127
127 const file = video.files[0] 128 expect(videoDetails.files).to.have.lengthOf(1)
129
130 const file = videoDetails.files[0]
128 const magnetUri = file.magnetUri 131 const magnetUri = file.magnetUri
129 expect(file.magnetUri).to.have.lengthOf.above(2) 132 expect(file.magnetUri).to.have.lengthOf.above(2)
130 expect(file.torrentUrl).to.equal(`${server.url}/static/torrents/${video.uuid}-${file.resolution}.torrent`) 133 expect(file.torrentUrl).to.equal(`${server.url}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
131 expect(file.fileUrl).to.equal(`${server.url}/static/webseed/${video.uuid}-${file.resolution}.webm`) 134 expect(file.fileUrl).to.equal(`${server.url}/static/webseed/${videoDetails.uuid}-${file.resolution}.webm`)
132 expect(file.resolution).to.equal(720) 135 expect(file.resolution).to.equal(720)
133 expect(file.resolutionLabel).to.equal('720p') 136 expect(file.resolutionLabel).to.equal('720p')
134 expect(file.size).to.equal(218910) 137 expect(file.size).to.equal(218910)
135 138
136 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 139 const test = await testVideoImage(server.url, 'video_short.webm', videoDetails.thumbnailPath)
137 expect(test).to.equal(true) 140 expect(test).to.equal(true)
138 141
139 videoId = video.id 142 videoId = videoDetails.id
140 videoUUID = video.uuid 143 videoUUID = videoDetails.uuid
141 144
142 const torrent = await webtorrentAdd(magnetUri) 145 const torrent = await webtorrentAdd(magnetUri)
143 expect(torrent.files).to.be.an('array') 146 expect(torrent.files).to.be.an('array')
@@ -167,6 +170,10 @@ describe('Test a single pod', function () {
167 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 170 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
168 expect(dateIsValid(video.createdAt)).to.be.true 171 expect(dateIsValid(video.createdAt)).to.be.true
169 expect(dateIsValid(video.updatedAt)).to.be.true 172 expect(dateIsValid(video.updatedAt)).to.be.true
173 expect(video.channel.name).to.equal('Default root channel')
174 expect(video.channel.isLocal).to.be.true
175 expect(dateIsValid(video.channel.createdAt)).to.be.true
176 expect(dateIsValid(video.channel.updatedAt)).to.be.true
170 177
171 expect(video.files).to.have.lengthOf(1) 178 expect(video.files).to.have.lengthOf(1)
172 179
@@ -200,7 +207,7 @@ describe('Test a single pod', function () {
200 const res = await getVideo(server.url, videoId) 207 const res = await getVideo(server.url, videoId)
201 208
202 const video = res.body 209 const video = res.body
203 expect(video.views).to.equal(2) 210 expect(video.views).to.equal(3)
204 }) 211 })
205 212
206 it('Should search the video by name by default', async function () { 213 it('Should search the video by name by default', async function () {
@@ -227,14 +234,6 @@ describe('Test a single pod', function () {
227 expect(dateIsValid(video.createdAt)).to.be.true 234 expect(dateIsValid(video.createdAt)).to.be.true
228 expect(dateIsValid(video.updatedAt)).to.be.true 235 expect(dateIsValid(video.updatedAt)).to.be.true
229 236
230 expect(video.files).to.have.lengthOf(1)
231
232 const file = video.files[0]
233 expect(file.magnetUri).to.have.lengthOf.above(2)
234 expect(file.resolution).to.equal(720)
235 expect(file.resolutionLabel).to.equal('720p')
236 expect(file.size).to.equal(218910)
237
238 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 237 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
239 expect(test).to.equal(true) 238 expect(test).to.equal(true)
240 }) 239 })
@@ -289,14 +288,6 @@ describe('Test a single pod', function () {
289 expect(dateIsValid(video.createdAt)).to.be.true 288 expect(dateIsValid(video.createdAt)).to.be.true
290 expect(dateIsValid(video.updatedAt)).to.be.true 289 expect(dateIsValid(video.updatedAt)).to.be.true
291 290
292 expect(video.files).to.have.lengthOf(1)
293
294 const file = video.files[0]
295 expect(file.magnetUri).to.have.lengthOf.above(2)
296 expect(file.resolution).to.equal(720)
297 expect(file.resolutionLabel).to.equal('720p')
298 expect(file.size).to.equal(218910)
299
300 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 291 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
301 expect(test).to.equal(true) 292 expect(test).to.equal(true)
302 }) 293 })
@@ -493,10 +484,13 @@ describe('Test a single pod', function () {
493 484
494 it('Should search the right magnetUri video', async function () { 485 it('Should search the right magnetUri video', async function () {
495 const video = videosListBase[0] 486 const video = videosListBase[0]
496 const res = await searchVideoWithPagination(server.url, encodeURIComponent(video.files[0].magnetUri), 'magnetUri', 0, 15) 487 const res = await getVideo(server.url, video.id)
488 const videoDetails = res.body
497 489
498 const videos = res.body.data 490 const res2 = await searchVideoWithPagination(server.url, encodeURIComponent(videoDetails.files[0].magnetUri), 'magnetUri', 0, 15)
499 expect(res.body.total).to.equal(1) 491
492 const videos = res2.body.data
493 expect(res2.body.total).to.equal(1)
500 expect(videos.length).to.equal(1) 494 expect(videos.length).to.equal(1)
501 expect(videos[0].name).to.equal(video.name) 495 expect(videos[0].name).to.equal(video.name)
502 }) 496 })
@@ -566,6 +560,11 @@ describe('Test a single pod', function () {
566 expect(dateIsValid(video.createdAt)).to.be.true 560 expect(dateIsValid(video.createdAt)).to.be.true
567 expect(dateIsValid(video.updatedAt)).to.be.true 561 expect(dateIsValid(video.updatedAt)).to.be.true
568 562
563 expect(video.channel.name).to.equal('Default root channel')
564 expect(video.channel.isLocal).to.be.true
565 expect(dateIsValid(video.channel.createdAt)).to.be.true
566 expect(dateIsValid(video.channel.updatedAt)).to.be.true
567
569 expect(video.files).to.have.lengthOf(1) 568 expect(video.files).to.have.lengthOf(1)
570 569
571 const file = video.files[0] 570 const file = video.files[0]
@@ -610,6 +609,11 @@ describe('Test a single pod', function () {
610 expect(dateIsValid(video.createdAt)).to.be.true 609 expect(dateIsValid(video.createdAt)).to.be.true
611 expect(dateIsValid(video.updatedAt)).to.be.true 610 expect(dateIsValid(video.updatedAt)).to.be.true
612 611
612 expect(video.channel.name).to.equal('Default root channel')
613 expect(video.channel.isLocal).to.be.true
614 expect(dateIsValid(video.channel.createdAt)).to.be.true
615 expect(dateIsValid(video.channel.updatedAt)).to.be.true
616
613 expect(video.files).to.have.lengthOf(1) 617 expect(video.files).to.have.lengthOf(1)
614 618
615 const file = video.files[0] 619 const file = video.files[0]
@@ -645,6 +649,11 @@ describe('Test a single pod', function () {
645 expect(dateIsValid(video.createdAt)).to.be.true 649 expect(dateIsValid(video.createdAt)).to.be.true
646 expect(dateIsValid(video.updatedAt)).to.be.true 650 expect(dateIsValid(video.updatedAt)).to.be.true
647 651
652 expect(video.channel.name).to.equal('Default root channel')
653 expect(video.channel.isLocal).to.be.true
654 expect(dateIsValid(video.channel.createdAt)).to.be.true
655 expect(dateIsValid(video.channel.updatedAt)).to.be.true
656
648 expect(video.files).to.have.lengthOf(1) 657 expect(video.files).to.have.lengthOf(1)
649 658
650 const file = video.files[0] 659 const file = video.files[0]