aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-pod.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/single-pod.js')
-rw-r--r--server/tests/api/single-pod.js71
1 files changed, 66 insertions, 5 deletions
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 })