diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:21:47 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:30:18 +0200 |
commit | 0e1dc3e7c69995c691e1dd82e3c2bc68748661ca (patch) | |
tree | f2a4b5cffc72e33c902b67083bbaa35b6f22f0ca /server/tests/api/video-transcoder.js | |
parent | b0f9f39ed70299a208d1b388c72de8b7f3510cb7 (diff) | |
download | PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.gz PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.zst PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.zip |
Convert tests to typescript
Diffstat (limited to 'server/tests/api/video-transcoder.js')
-rw-r--r-- | server/tests/api/video-transcoder.js | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/server/tests/api/video-transcoder.js b/server/tests/api/video-transcoder.js deleted file mode 100644 index c7af3cf11..000000000 --- a/server/tests/api/video-transcoder.js +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* eslint-disable no-unused-expressions */ | ||
2 | |||
3 | 'use strict' | ||
4 | |||
5 | const chai = require('chai') | ||
6 | const each = require('async/each') | ||
7 | const expect = chai.expect | ||
8 | const series = require('async/series') | ||
9 | const webtorrent = new (require('webtorrent'))() | ||
10 | |||
11 | const loginUtils = require('../utils/login') | ||
12 | const serversUtils = require('../utils/servers') | ||
13 | const videosUtils = require('../utils/videos') | ||
14 | |||
15 | describe('Test video transcoding', function () { | ||
16 | let servers = [] | ||
17 | |||
18 | before(function (done) { | ||
19 | this.timeout(30000) | ||
20 | |||
21 | series([ | ||
22 | // Run servers | ||
23 | function (next) { | ||
24 | serversUtils.flushAndRunMultipleServers(2, function (serversRun) { | ||
25 | servers = serversRun | ||
26 | next() | ||
27 | }) | ||
28 | }, | ||
29 | // Get the access tokens | ||
30 | function (next) { | ||
31 | each(servers, function (server, callbackEach) { | ||
32 | loginUtils.loginAndGetAccessToken(server, function (err, accessToken) { | ||
33 | if (err) return callbackEach(err) | ||
34 | |||
35 | server.accessToken = accessToken | ||
36 | callbackEach() | ||
37 | }) | ||
38 | }, next) | ||
39 | } | ||
40 | ], done) | ||
41 | }) | ||
42 | |||
43 | it('Should not transcode video on server 1', function (done) { | ||
44 | this.timeout(60000) | ||
45 | |||
46 | const videoAttributes = { | ||
47 | name: 'my super name for pod 1', | ||
48 | description: 'my super description for pod 1', | ||
49 | fixture: 'video_short.webm' | ||
50 | } | ||
51 | videosUtils.uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes, function (err) { | ||
52 | if (err) throw err | ||
53 | |||
54 | setTimeout(function () { | ||
55 | videosUtils.getVideosList(servers[0].url, function (err, res) { | ||
56 | if (err) throw err | ||
57 | |||
58 | const video = res.body.data[0] | ||
59 | const magnetUri = video.files[0].magnetUri | ||
60 | expect(magnetUri).to.match(/\.webm/) | ||
61 | |||
62 | webtorrent.add(magnetUri, function (torrent) { | ||
63 | expect(torrent.files).to.exist | ||
64 | expect(torrent.files.length).to.equal(1) | ||
65 | expect(torrent.files[0].path).match(/\.webm$/) | ||
66 | |||
67 | done() | ||
68 | }) | ||
69 | }) | ||
70 | }, 30000) | ||
71 | }) | ||
72 | }) | ||
73 | |||
74 | it('Should transcode video on server 2', function (done) { | ||
75 | this.timeout(60000) | ||
76 | |||
77 | const videoAttributes = { | ||
78 | name: 'my super name for pod 2', | ||
79 | description: 'my super description for pod 2', | ||
80 | fixture: 'video_short.webm' | ||
81 | } | ||
82 | videosUtils.uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes, function (err) { | ||
83 | if (err) throw err | ||
84 | |||
85 | setTimeout(function () { | ||
86 | videosUtils.getVideosList(servers[1].url, function (err, res) { | ||
87 | if (err) throw err | ||
88 | |||
89 | const video = res.body.data[0] | ||
90 | const magnetUri = video.files[0].magnetUri | ||
91 | expect(magnetUri).to.match(/\.mp4/) | ||
92 | |||
93 | webtorrent.add(magnetUri, function (torrent) { | ||
94 | expect(torrent.files).to.exist | ||
95 | expect(torrent.files.length).to.equal(1) | ||
96 | expect(torrent.files[0].path).match(/\.mp4$/) | ||
97 | |||
98 | done() | ||
99 | }) | ||
100 | }) | ||
101 | }, 30000) | ||
102 | }) | ||
103 | }) | ||
104 | |||
105 | after(function (done) { | ||
106 | servers.forEach(function (server) { | ||
107 | process.kill(-server.app.pid) | ||
108 | }) | ||
109 | |||
110 | // Keep the logs if the test failed | ||
111 | if (this.ok) { | ||
112 | serversUtils.flushTests(done) | ||
113 | } else { | ||
114 | done() | ||
115 | } | ||
116 | }) | ||
117 | }) | ||