aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/singlePod.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-10 21:55:59 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-10 21:56:16 +0200
commit9e5f374090ea0fb16f93edd79d5ad61a55db91e5 (patch)
treec48f8952d450cc62ed304b0b476d14f42499391f /server/tests/api/singlePod.js
parentcbe2f7c34822b1bd3b1f8c691f79f0c29cf21f07 (diff)
downloadPeerTube-9e5f374090ea0fb16f93edd79d5ad61a55db91e5.tar.gz
PeerTube-9e5f374090ea0fb16f93edd79d5ad61a55db91e5.tar.zst
PeerTube-9e5f374090ea0fb16f93edd79d5ad61a55db91e5.zip
Add tests for thumbnails
Diffstat (limited to 'server/tests/api/singlePod.js')
-rw-r--r--server/tests/api/singlePod.js57
1 files changed, 45 insertions, 12 deletions
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index e2999530e..9a9af0901 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -76,14 +76,19 @@ describe('Test a single pod', function () {
76 expect(video.author).to.equal('root') 76 expect(video.author).to.equal('root')
77 expect(video.isLocal).to.be.true 77 expect(video.isLocal).to.be.true
78 78
79 video_id = video.id 79 utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
80 if (err) throw err
81 expect(test).to.equal(true)
80 82
81 webtorrent.add(video.magnetUri, function (torrent) { 83 video_id = video.id
82 expect(torrent.files).to.exist
83 expect(torrent.files.length).to.equal(1)
84 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
85 84
86 done() 85 webtorrent.add(video.magnetUri, function (torrent) {
86 expect(torrent.files).to.exist
87 expect(torrent.files.length).to.equal(1)
88 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
89
90 done()
91 })
87 }) 92 })
88 }) 93 })
89 }) 94 })
@@ -103,12 +108,17 @@ describe('Test a single pod', function () {
103 expect(video.author).to.equal('root') 108 expect(video.author).to.equal('root')
104 expect(video.isLocal).to.be.true 109 expect(video.isLocal).to.be.true
105 110
106 webtorrent.add(video.magnetUri, function (torrent) { 111 utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
107 expect(torrent.files).to.exist 112 if (err) throw err
108 expect(torrent.files.length).to.equal(1) 113 expect(test).to.equal(true)
109 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
110 114
111 done() 115 webtorrent.add(video.magnetUri, function (torrent) {
116 expect(torrent.files).to.exist
117 expect(torrent.files.length).to.equal(1)
118 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
119
120 done()
121 })
112 }) 122 })
113 }) 123 })
114 }) 124 })
@@ -127,7 +137,12 @@ describe('Test a single pod', function () {
127 expect(video.author).to.equal('root') 137 expect(video.author).to.equal('root')
128 expect(video.isLocal).to.be.true 138 expect(video.isLocal).to.be.true
129 139
130 done() 140 utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
141 if (err) throw err
142 expect(test).to.equal(true)
143
144 done()
145 })
131 }) 146 })
132 }) 147 })
133 148
@@ -197,6 +212,24 @@ describe('Test a single pod', function () {
197 }) 212 })
198 }) 213 })
199 214
215 it('Should have the correct thumbnails', function (done) {
216 utils.getVideosList(server.url, function (err, res) {
217 const videos = res.body
218
219 async.each(videos, function (video, callback_each) {
220 if (err) throw err
221 const video_name = video.name.replace(' name', '')
222
223 utils.testImage(server.url, video_name, video.thumbnail_path, function (err, test) {
224 if (err) throw err
225
226 expect(test).to.equal(true)
227 callback_each()
228 })
229 }, done)
230 })
231 })
232
200 after(function (done) { 233 after(function (done) {
201 process.kill(-server.app.pid) 234 process.kill(-server.app.pid)
202 process.kill(-webtorrent.app.pid) 235 process.kill(-webtorrent.app.pid)