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 const magnetUri = video.files[0].magnetUri
46 expect(magnetUri).to.match(/\.webm/)
48 const torrent = await webtorrentAdd(magnetUri)
49 expect(torrent.files).to.be.an('array')
50 expect(torrent.files.length).to.equal(1)
51 expect(torrent.files[0].path).match(/\.webm$/)
54 it('Should transcode video on server 2', async function () {
57 const videoAttributes = {
58 name: 'my super name for pod 2',
59 description: 'my super description for pod 2',
60 fixture: 'video_short.webm'
62 await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
66 const res = await getVideosList(servers[1].url)
68 const video = res.body.data[0]
69 const magnetUri = video.files[0].magnetUri
70 expect(magnetUri).to.match(/\.mp4/)
72 const torrent = await webtorrentAdd(magnetUri)
73 expect(torrent.files).to.be.an('array')
74 expect(torrent.files.length).to.equal(1)
75 expect(torrent.files[0].path).match(/\.mp4$/)
78 after(async function () {
79 killallServers(servers)
81 // Keep the logs if the test failed