aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/singlePod.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/singlePod.js')
-rw-r--r--server/tests/api/singlePod.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index efd8a64bc..e2999530e 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -4,6 +4,7 @@ const async = require('async')
4const chai = require('chai') 4const chai = require('chai')
5const expect = chai.expect 5const expect = chai.expect
6const fs = require('fs') 6const fs = require('fs')
7const keyBy = require('lodash/keyBy')
7const pathUtils = require('path') 8const pathUtils = require('path')
8 9
9const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) 10const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
@@ -165,6 +166,37 @@ describe('Test a single pod', function () {
165 }) 166 })
166 }) 167 })
167 168
169 it('Should upload 6 videos', function (done) {
170 this.timeout(25000)
171 const videos = [
172 'video_short.mp4', 'video_short.ogv', 'video_short.webm',
173 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
174 ]
175 async.each(videos, function (video, callback_each) {
176 utils.uploadVideo(server.url, server.access_token, video + ' name', video + ' description', video, callback_each)
177 }, done)
178 })
179
180 it('Should have the correct durations', function (done) {
181 utils.getVideosList(server.url, function (err, res) {
182 if (err) throw err
183
184 const videos = res.body
185 expect(videos).to.be.an('array')
186 expect(videos.length).to.equal(6)
187
188 const videos_by_name = keyBy(videos, 'name')
189 expect(videos_by_name['video_short.mp4 name'].duration).to.equal(5)
190 expect(videos_by_name['video_short.ogv name'].duration).to.equal(5)
191 expect(videos_by_name['video_short.webm name'].duration).to.equal(5)
192 expect(videos_by_name['video_short1.webm name'].duration).to.equal(10)
193 expect(videos_by_name['video_short2.webm name'].duration).to.equal(5)
194 expect(videos_by_name['video_short3.webm name'].duration).to.equal(5)
195
196 done()
197 })
198 })
199
168 after(function (done) { 200 after(function (done) {
169 process.kill(-server.app.pid) 201 process.kill(-server.app.pid)
170 process.kill(-webtorrent.app.pid) 202 process.kill(-webtorrent.app.pid)