1 /* tslint:disable:no-unused-expression */
4 import * as chai from 'chai'
5 const expect = chai.expect
13 setAccessTokensToServers,
14 flushAndRunMultipleServers,
19 describe('Test video transcoding', function () {
20 let servers: ServerInfo[] = []
22 before(async function () {
26 servers = await flushAndRunMultipleServers(2)
28 await setAccessTokensToServers(servers)
31 it('Should not transcode video on server 1', async function () {
34 const videoAttributes = {
35 name: 'my super name for pod 1',
36 description: 'my super description for pod 1',
37 fixture: 'video_short.webm'
39 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
43 const res = await getVideosList(servers[0].url)
44 const video = res.body.data[0]
45 expect(video.files).to.have.lengthOf(1)
47 const magnetUri = video.files[0].magnetUri
48 expect(magnetUri).to.match(/\.webm/)
50 const torrent = await webtorrentAdd(magnetUri)
51 expect(torrent.files).to.be.an('array')
52 expect(torrent.files.length).to.equal(1)
53 expect(torrent.files[0].path).match(/\.webm$/)
56 it('Should transcode video on server 2', async function () {
59 const videoAttributes = {
60 name: 'my super name for pod 2',
61 description: 'my super description for pod 2',
62 fixture: 'video_short.webm'
64 await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
68 const res = await getVideosList(servers[1].url)
70 const video = res.body.data[0]
71 expect(video.files).to.have.lengthOf(4)
73 const magnetUri = video.files[0].magnetUri
74 expect(magnetUri).to.match(/\.mp4/)
76 const torrent = await webtorrentAdd(magnetUri)
77 expect(torrent.files).to.be.an('array')
78 expect(torrent.files.length).to.equal(1)
79 expect(torrent.files[0].path).match(/\.mp4$/)
82 after(async function () {
83 killallServers(servers)
85 // Keep the logs if the test failed