From 876d1bcfd07b14d47ba377474e3bb680872d1f7a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 6 Dec 2015 17:09:07 +0100 Subject: Tests refractoring --- test/api/checkParams.js | 18 ++-- test/api/fixtures/video_short.mp4 | Bin 0 -> 38783 bytes test/api/fixtures/video_short.ogv | Bin 0 -> 140849 bytes test/api/fixtures/video_short.webm | Bin 0 -> 218910 bytes test/api/fixtures/video_short1.webm | Bin 0 -> 572456 bytes test/api/fixtures/video_short2.webm | Bin 0 -> 942961 bytes test/api/fixtures/video_short3.webm | Bin 0 -> 292677 bytes test/api/fixtures/video_short_fake.webm | 1 + test/api/friendsAdvanced.js | 47 ++------- test/api/friendsBasic.js | 25 ++--- test/api/multiplePods.js | 97 ++++++------------- test/api/singlePod.js | 147 +++++++++++------------------ test/api/utils.js | 162 ++++++++++++++++++++++++++++++++ test/fixtures/video_short.mp4 | Bin 38783 -> 0 bytes test/fixtures/video_short.ogv | Bin 140849 -> 0 bytes test/fixtures/video_short.webm | Bin 218910 -> 0 bytes test/fixtures/video_short1.webm | Bin 572456 -> 0 bytes test/fixtures/video_short2.webm | Bin 942961 -> 0 bytes test/fixtures/video_short3.webm | Bin 292677 -> 0 bytes test/fixtures/video_short_fake.webm | 1 - test/utils.js | 81 ---------------- 21 files changed, 271 insertions(+), 308 deletions(-) create mode 100644 test/api/fixtures/video_short.mp4 create mode 100644 test/api/fixtures/video_short.ogv create mode 100644 test/api/fixtures/video_short.webm create mode 100644 test/api/fixtures/video_short1.webm create mode 100644 test/api/fixtures/video_short2.webm create mode 100644 test/api/fixtures/video_short3.webm create mode 100644 test/api/fixtures/video_short_fake.webm create mode 100644 test/api/utils.js delete mode 100644 test/fixtures/video_short.mp4 delete mode 100644 test/fixtures/video_short.ogv delete mode 100644 test/fixtures/video_short.webm delete mode 100644 test/fixtures/video_short1.webm delete mode 100644 test/fixtures/video_short2.webm delete mode 100644 test/fixtures/video_short3.webm delete mode 100644 test/fixtures/video_short_fake.webm delete mode 100644 test/utils.js (limited to 'test') diff --git a/test/api/checkParams.js b/test/api/checkParams.js index a06e32bbc..0fa83655f 100644 --- a/test/api/checkParams.js +++ b/test/api/checkParams.js @@ -1,11 +1,11 @@ ;(function () { 'use strict' - var request = require('supertest') var chai = require('chai') var expect = chai.expect + var request = require('supertest') - var utils = require('../utils') + var utils = require('./utils') describe('Test parameters validator', function () { var app = null @@ -129,7 +129,7 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short.webm' + 'input_video': __dirname + '/fixtures/video_short.webm' } makePostRequest(path, data, attach, done) }) @@ -140,7 +140,7 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short.webm' + 'input_video': __dirname + '/fixtures/video_short.webm' } makePostRequest(path, data, attach, done) }) @@ -150,7 +150,7 @@ name: 'my super name' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short.webm' + 'input_video': __dirname + '/fixtures/video_short.webm' } makePostRequest(path, data, attach, done) }) @@ -163,7 +163,7 @@ 'very very very very very very very very very very very very very very very long' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short.webm' + 'input_video': __dirname + '/fixtures/video_short.webm' } makePostRequest(path, data, attach, done) }) @@ -194,12 +194,12 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short.webm' + 'input_video': __dirname + '/fixtures/video_short.webm' } makePostRequest(path, data, attach, function () { - attach.input_video = __dirname + '/../fixtures/video_short.mp4' + attach.input_video = __dirname + '/fixtures/video_short.mp4' makePostRequest(path, data, attach, function () { - attach.input_video = __dirname + '/../fixtures/video_short.ogv' + attach.input_video = __dirname + '/fixtures/video_short.ogv' makePostRequest(path, data, attach, done, true) }, true) }, true) diff --git a/test/api/fixtures/video_short.mp4 b/test/api/fixtures/video_short.mp4 new file mode 100644 index 000000000..35678362b Binary files /dev/null and b/test/api/fixtures/video_short.mp4 differ diff --git a/test/api/fixtures/video_short.ogv b/test/api/fixtures/video_short.ogv new file mode 100644 index 000000000..9e253da82 Binary files /dev/null and b/test/api/fixtures/video_short.ogv differ diff --git a/test/api/fixtures/video_short.webm b/test/api/fixtures/video_short.webm new file mode 100644 index 000000000..bf4b0ab6c Binary files /dev/null and b/test/api/fixtures/video_short.webm differ diff --git a/test/api/fixtures/video_short1.webm b/test/api/fixtures/video_short1.webm new file mode 100644 index 000000000..70ac0c644 Binary files /dev/null and b/test/api/fixtures/video_short1.webm differ diff --git a/test/api/fixtures/video_short2.webm b/test/api/fixtures/video_short2.webm new file mode 100644 index 000000000..13d72dff7 Binary files /dev/null and b/test/api/fixtures/video_short2.webm differ diff --git a/test/api/fixtures/video_short3.webm b/test/api/fixtures/video_short3.webm new file mode 100644 index 000000000..cde5dcd58 Binary files /dev/null and b/test/api/fixtures/video_short3.webm differ diff --git a/test/api/fixtures/video_short_fake.webm b/test/api/fixtures/video_short_fake.webm new file mode 100644 index 000000000..d85290ae5 --- /dev/null +++ b/test/api/fixtures/video_short_fake.webm @@ -0,0 +1 @@ +this is a fake video mouahahah diff --git a/test/api/friendsAdvanced.js b/test/api/friendsAdvanced.js index 680d90aee..7a0940647 100644 --- a/test/api/friendsAdvanced.js +++ b/test/api/friendsAdvanced.js @@ -1,60 +1,29 @@ ;(function () { 'use strict' - var request = require('supertest') var chai = require('chai') var expect = chai.expect - var utils = require('../utils') + var utils = require('./utils') describe('Test advanced friends', function () { - var path = '/api/v1/pods/makefriends' var apps = [] var urls = [] function makeFriend (pod_number, callback) { - // The first pod make friend with the third - request(urls[pod_number - 1]) - .get(path) - .set('Accept', 'application/json') - .expect(204) - .end(function (err, res) { - if (err) throw err - - // Wait for the request between pods - setTimeout(function () { - callback() - }, 1000) - }) + return utils.makeFriend(urls[pod_number - 1], callback) } function getFriendsList (pod_number, end) { - var path = '/api/v1/pods/' - - request(urls[pod_number - 1]) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(end) + return utils.getFriendsList(urls[pod_number - 1], end) } function uploadVideo (pod_number, callback) { - var path = '/api/v1/videos' - - request(urls[pod_number - 1]) - .post(path) - .set('Accept', 'application/json') - .field('name', 'my super video') - .field('description', 'my super description') - .attach('input_video', __dirname + '/../fixtures/video_short.webm') - .expect(201) - .end(function (err) { - if (err) throw err - - // Wait for the retry requests - setTimeout(callback, 10000) - }) + var name = 'my super video' + var description = 'my super description' + var fixture = 'video_short.webm' + + return utils.uploadVideo(urls[pod_number - 1], name, description, fixture, callback) } beforeEach(function (done) { diff --git a/test/api/friendsBasic.js b/test/api/friendsBasic.js index 40ed34199..43ec41633 100644 --- a/test/api/friendsBasic.js +++ b/test/api/friendsBasic.js @@ -1,23 +1,12 @@ ;(function () { 'use strict' - var request = require('supertest') + var async = require('async') var chai = require('chai') var expect = chai.expect - var async = require('async') - - var utils = require('../utils') - - function getFriendsList (url, end) { - var path = '/api/v1/pods/' + var request = require('supertest') - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(end) - } + var utils = require('./utils') describe('Test basic friends', function () { var apps = [] @@ -34,7 +23,7 @@ it('Should not have friends', function (done) { async.each(urls, function (url, callback) { - getFriendsList(url, function (err, res) { + utils.getFriendsList(url, function (err, res) { if (err) throw err var result = res.body @@ -59,7 +48,7 @@ friends.push(urls[i]) } - getFriendsList(url_to_test, function (err, res) { + utils.getFriendsList(url_to_test, function (err, res) { if (err) throw err var result = res.body @@ -88,7 +77,7 @@ // Wait for the request between pods setTimeout(function () { // The second pod should have the third as a friend - getFriendsList(urls[1], function (err, res) { + utils.getFriendsList(urls[1], function (err, res) { if (err) throw err var result = res.body @@ -97,7 +86,7 @@ expect(result[0].url).to.be.equal(urls[2]) // Same here, the third pod should have the second pod as a friend - getFriendsList(urls[2], function (err, res) { + utils.getFriendsList(urls[2], function (err, res) { if (err) throw err var result = res.body diff --git a/test/api/multiplePods.js b/test/api/multiplePods.js index 3ce57afa8..dd666d73e 100644 --- a/test/api/multiplePods.js +++ b/test/api/multiplePods.js @@ -1,86 +1,47 @@ ;(function () { 'use strict' - var request = require('supertest') + var async = require('async') var chai = require('chai') var expect = chai.expect - var async = require('async') - var utils = require('../utils') + var utils = require('./utils') var webtorrent = require(__dirname + '/../../src/webTorrentNode') webtorrent.silent = true describe('Test multiple pods', function () { - var path = '/api/v1/videos' var apps = [] var urls = [] var to_remove = [] - function getVideosList (url, end) { - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(end) - } - - function uploadVideo (url, name, description, fixture, end) { - request(url) - .post(path) - .set('Accept', 'application/json') - .field('name', name) - .field('description', description) - .attach('input_video', __dirname + '/../fixtures/' + fixture) - .expect(201) - .end(end) - } - - function removeVideo (url, id, end) { - request(url) - .delete(path + '/' + id) - .set('Accept', 'application/json') - .expect(204) - .end(end) - } - before(function (done) { this.timeout(30000) - var path_friends = '/api/v1/pods/makefriends' utils.runMultipleServers(3, function (apps_run, urls_run) { apps = apps_run urls = urls_run // The second pod make friend with the third - request(urls[1]) - .get(path_friends) - .set('Accept', 'application/json') - .expect(204) - .end(function (err, res) { - if (err) throw err + utils.makeFriend(urls[1], function (err, res) { + if (err) throw err - // Wait for the request between pods - setTimeout(function () { - request(urls[0]) - .get(path_friends) - .set('Accept', 'application/json') - .expect(204) - .end(function (err, res) { - if (err) throw err + // Wait for the request between pods + setTimeout(function () { + utils.makeFriend(urls[0], function (err, res) { + if (err) throw err - webtorrent.create({ host: 'client', port: '1' }, function () { - done() - }) - }) - }, 10000) - }) + webtorrent.create({ host: 'client', port: '1' }, function () { + done() + }) + }) + }, 10000) + }) }) }) it('Should not have videos for all pods', function (done) { async.each(urls, function (url, callback) { - getVideosList(url, function (err, res) { + utils.getVideosList(url, function (err, res) { if (err) throw err expect(res.body).to.be.an('array') @@ -99,7 +60,7 @@ it('Should upload the video on pod 1 and propagate on each pod', function (done) { this.timeout(15000) - uploadVideo(urls[0], 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', function (err) { + utils.uploadVideo(urls[0], 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', function (err) { if (err) throw err setTimeout(function () { @@ -107,7 +68,7 @@ async.each(urls, function (url, callback) { var base_magnet = null - getVideosList(url, function (err, res) { + utils.getVideosList(url, function (err, res) { if (err) throw err var videos = res.body @@ -140,7 +101,7 @@ it('Should upload the video on pod 2 and propagate on each pod', function (done) { this.timeout(15000) - uploadVideo(urls[1], 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', function (err) { + utils.uploadVideo(urls[1], 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', function (err) { if (err) throw err setTimeout(function () { @@ -148,7 +109,7 @@ async.each(urls, function (url, callback) { var base_magnet = null - getVideosList(url, function (err, res) { + utils.getVideosList(url, function (err, res) { if (err) throw err var videos = res.body @@ -181,16 +142,16 @@ it('Should upload two videos on pod 3 and propagate on each pod', function (done) { this.timeout(15000) - uploadVideo(urls[2], 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', function (err) { + utils.uploadVideo(urls[2], 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', function (err) { if (err) throw err - uploadVideo(urls[2], 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', function (err) { + utils.uploadVideo(urls[2], 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', function (err) { if (err) throw err setTimeout(function () { var base_magnet = null // All pods should have this video async.each(urls, function (url, callback) { - getVideosList(url, function (err, res) { + utils.getVideosList(url, function (err, res) { if (err) throw err var videos = res.body @@ -233,7 +194,7 @@ // Yes, this could be long this.timeout(200000) - getVideosList(urls[2], function (err, res) { + utils.getVideosList(urls[2], function (err, res) { if (err) throw err var video = res.body[0] @@ -254,7 +215,7 @@ // Yes, this could be long this.timeout(200000) - getVideosList(urls[0], function (err, res) { + utils.getVideosList(urls[0], function (err, res) { if (err) throw err var video = res.body[1] @@ -273,7 +234,7 @@ // Yes, this could be long this.timeout(200000) - getVideosList(urls[1], function (err, res) { + utils.getVideosList(urls[1], function (err, res) { if (err) throw err var video = res.body[2] @@ -292,7 +253,7 @@ // Yes, this could be long this.timeout(200000) - getVideosList(urls[0], function (err, res) { + utils.getVideosList(urls[0], function (err, res) { if (err) throw err var video = res.body[3] @@ -310,9 +271,9 @@ it('Should remove the file 3 and 3-2 by asking pod 3', function (done) { this.timeout(15000) - removeVideo(urls[2], to_remove[0], function (err) { + utils.removeVideo(urls[2], to_remove[0], function (err) { if (err) throw err - removeVideo(urls[2], to_remove[1], function (err) { + utils.removeVideo(urls[2], to_remove[1], function (err) { if (err) throw err // Wait the propagation to the other pods @@ -325,7 +286,7 @@ it('Should have videos 1 and 3 on each pod', function (done) { async.each(urls, function (url, callback) { - getVideosList(url, function (err, res) { + utils.getVideosList(url, function (err, res) { if (err) throw err var videos = res.body diff --git a/test/api/singlePod.js b/test/api/singlePod.js index 301065f39..be944d8da 100644 --- a/test/api/singlePod.js +++ b/test/api/singlePod.js @@ -1,17 +1,16 @@ ;(function () { 'use strict' - var request = require('supertest') var chai = require('chai') var fs = require('fs') var expect = chai.expect + var webtorrent = require(__dirname + '/../../src/webTorrentNode') webtorrent.silent = true - var utils = require('../utils') + var utils = require('./utils') describe('Test a single pod', function () { - var path = '/api/v1/videos' var app = null var url = '' var video_id = -1 @@ -32,135 +31,99 @@ }) it('Should not have videos', function (done) { - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(function (err, res) { - if (err) throw err + utils.getVideosList(url, function (err, res) { + if (err) throw err - expect(res.body).to.be.an('array') - expect(res.body.length).to.equal(0) + expect(res.body).to.be.an('array') + expect(res.body.length).to.equal(0) - done() - }) + done() + }) }) it('Should upload the video', function (done) { this.timeout(5000) - - request(url) - .post(path) - .set('Accept', 'application/json') - .field('name', 'my super name') - .field('description', 'my super description') - .attach('input_video', __dirname + '/../fixtures/video_short.webm') - .expect(201, done) + utils.uploadVideo(url, 'my super name', 'my super description', 'video_short.webm', done) }) it('Should seed the uploaded video', function (done) { // Yes, this could be long this.timeout(60000) - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(function (err, res) { - if (err) throw err + utils.getVideosList(url, function (err, res) { + if (err) throw err - expect(res.body).to.be.an('array') - expect(res.body.length).to.equal(1) + expect(res.body).to.be.an('array') + expect(res.body.length).to.equal(1) - var video = res.body[0] - expect(video.name).to.equal('my super name') - expect(video.description).to.equal('my super description') - expect(video.podUrl).to.equal('http://localhost:9001') - expect(video.magnetUri).to.exist + var video = res.body[0] + expect(video.name).to.equal('my super name') + expect(video.description).to.equal('my super description') + expect(video.podUrl).to.equal('http://localhost:9001') + expect(video.magnetUri).to.exist - video_id = video._id + video_id = video._id - webtorrent.add(video.magnetUri, function (torrent) { - expect(torrent.files).to.exist - expect(torrent.files.length).to.equal(1) - expect(torrent.files[0].path).to.exist.and.to.not.equal('') + webtorrent.add(video.magnetUri, function (torrent) { + expect(torrent.files).to.exist + expect(torrent.files.length).to.equal(1) + expect(torrent.files[0].path).to.exist.and.to.not.equal('') - done() - }) + done() }) + }) }) it('Should search the video', function (done) { - request(url) - .get(path + '/search/my') - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(function (err, res) { - if (err) throw err + utils.searchVideo(url, 'my', function (err, res) { + if (err) throw err - expect(res.body).to.be.an('array') - expect(res.body.length).to.equal(1) + expect(res.body).to.be.an('array') + expect(res.body.length).to.equal(1) - var video = res.body[0] - expect(video.name).to.equal('my super name') - expect(video.description).to.equal('my super description') - expect(video.podUrl).to.equal('http://localhost:9001') - expect(video.magnetUri).to.exist + var video = res.body[0] + expect(video.name).to.equal('my super name') + expect(video.description).to.equal('my super description') + expect(video.podUrl).to.equal('http://localhost:9001') + expect(video.magnetUri).to.exist - done() - }) + done() + }) }) it('Should not find a search', function (done) { - request(url) - .get(path + '/search/hello') - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(function (err, res) { - if (err) throw err + utils.searchVideo(url, 'hello', function (err, res) { + if (err) throw err - expect(res.body).to.be.an('array') - expect(res.body.length).to.equal(0) + expect(res.body).to.be.an('array') + expect(res.body.length).to.equal(0) - done() - }) + done() + }) }) it('Should remove the video', function (done) { - request(url) - .delete(path + '/' + video_id) - .set('Accept', 'application/json') - .expect(204) - .end(function (err, res) { - if (err) throw err + utils.removeVideo(url, video_id, function (err) { + if (err) throw err - fs.readdir(__dirname + '/../../test1/uploads/', function (err, files) { - if (err) throw err + fs.readdir(__dirname + '/../../test1/uploads/', function (err, files) { + if (err) throw err - expect(files.length).to.equal(0) - done() - }) + expect(files.length).to.equal(0) + done() }) + }) }) it('Should not have videos', function (done) { - request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) - .end(function (err, res) { - if (err) throw err + utils.getVideosList(url, function (err, res) { + if (err) throw err - expect(res.body).to.be.an('array') - expect(res.body.length).to.equal(0) + expect(res.body).to.be.an('array') + expect(res.body.length).to.equal(0) - done() - }) + done() + }) }) after(function (done) { diff --git a/test/api/utils.js b/test/api/utils.js new file mode 100644 index 000000000..8d059b01c --- /dev/null +++ b/test/api/utils.js @@ -0,0 +1,162 @@ +;(function () { + 'use strict' + + var child_process = require('child_process') + var exec = child_process.exec + var fork = child_process.fork + var request = require('supertest') + + function flushTests (callback) { + exec(__dirname + '/../../scripts/clean_test.sh', function () { + callback() + }) + } + + function getFriendsList (url, end) { + var path = '/api/v1/pods/' + + request(url) + .get(path) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) + } + + function getVideosList (url, end) { + var path = '/api/v1/videos' + + request(url) + .get(path) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) + } + + function makeFriend (url, callback) { + var path = '/api/v1/pods/makefriends' + + // The first pod make friend with the third + request(url) + .get(path) + .set('Accept', 'application/json') + .expect(204) + .end(function (err, res) { + if (err) throw err + + // Wait for the request between pods + setTimeout(function () { + callback() + }, 1000) + }) + } + + function uploadVideo (url, name, description, fixture, end) { + var path = '/api/v1/videos' + + request(url) + .post(path) + .set('Accept', 'application/json') + .field('name', name) + .field('description', description) + .attach('input_video', __dirname + '/fixtures/' + fixture) + .expect(201) + .end(end) + } + + function removeVideo (url, id, end) { + var path = '/api/v1/videos' + + request(url) + .delete(path + '/' + id) + .set('Accept', 'application/json') + .expect(204) + .end(end) + } + + function runMultipleServers (total_servers, serversRun) { + var apps = [] + var urls = [] + var i = 0 + + function anotherServerDone (number, app, url) { + apps[number - 1] = app + urls[number - 1] = url + i++ + if (i === total_servers) { + serversRun(apps, urls) + } + } + + flushTests(function () { + for (var j = 1; j <= total_servers; j++) { + (function (k) { // TODO: ES6 with let + // For the virtual buffer + setTimeout(function () { + runServer(k, function (app, url) { + anotherServerDone(k, app, url) + }) + }, 1000 * k) + })(j) + } + }) + } + + function runServer (number, callback) { + var port = 9000 + number + var server_run_string = { + 'Connected to mongodb': false, + 'Server listening on port': false + } + + // Share the environment + var env = Object.create(process.env) + env.NODE_ENV = 'test' + env.NODE_APP_INSTANCE = number + var options = { + silent: true, + env: env, + detached: true + } + + var app = fork(__dirname + '/../../server.js', [], options) + app.stdout.on('data', function onStdout (data) { + var dont_continue = false + // Check if all required sentences are here + for (var key of Object.keys(server_run_string)) { + if (data.toString().indexOf(key) !== -1) server_run_string[key] = true + if (server_run_string[key] === false) dont_continue = true + } + + // If no, there is maybe one thing not already initialized (mongodb...) + if (dont_continue === true) return + + app.stdout.removeListener('data', onStdout) + callback(app, 'http://localhost:' + port) + }) + } + + function searchVideo (url, search, end) { + var path = '/api/v1/videos' + + request(url) + .get(path + '/search/' + search) + .set('Accept', 'application/json') + .expect(200) + .expect('Content-Type', /json/) + .end(end) + } + + module.exports = { + flushTests: flushTests, + getFriendsList: getFriendsList, + getVideosList: getVideosList, + makeFriend: makeFriend, + removeVideo: removeVideo, + runMultipleServers: runMultipleServers, + runServer: runServer, + searchVideo: searchVideo, + uploadVideo: uploadVideo + } +})() diff --git a/test/fixtures/video_short.mp4 b/test/fixtures/video_short.mp4 deleted file mode 100644 index 35678362b..000000000 Binary files a/test/fixtures/video_short.mp4 and /dev/null differ diff --git a/test/fixtures/video_short.ogv b/test/fixtures/video_short.ogv deleted file mode 100644 index 9e253da82..000000000 Binary files a/test/fixtures/video_short.ogv and /dev/null differ diff --git a/test/fixtures/video_short.webm b/test/fixtures/video_short.webm deleted file mode 100644 index bf4b0ab6c..000000000 Binary files a/test/fixtures/video_short.webm and /dev/null differ diff --git a/test/fixtures/video_short1.webm b/test/fixtures/video_short1.webm deleted file mode 100644 index 70ac0c644..000000000 Binary files a/test/fixtures/video_short1.webm and /dev/null differ diff --git a/test/fixtures/video_short2.webm b/test/fixtures/video_short2.webm deleted file mode 100644 index 13d72dff7..000000000 Binary files a/test/fixtures/video_short2.webm and /dev/null differ diff --git a/test/fixtures/video_short3.webm b/test/fixtures/video_short3.webm deleted file mode 100644 index cde5dcd58..000000000 Binary files a/test/fixtures/video_short3.webm and /dev/null differ diff --git a/test/fixtures/video_short_fake.webm b/test/fixtures/video_short_fake.webm deleted file mode 100644 index d85290ae5..000000000 --- a/test/fixtures/video_short_fake.webm +++ /dev/null @@ -1 +0,0 @@ -this is a fake video mouahahah diff --git a/test/utils.js b/test/utils.js deleted file mode 100644 index af3e8665d..000000000 --- a/test/utils.js +++ /dev/null @@ -1,81 +0,0 @@ -;(function () { - 'use strict' - - var child_process = require('child_process') - var fork = child_process.fork - var exec = child_process.exec - - function runMultipleServers (total_servers, serversRun) { - var apps = [] - var urls = [] - var i = 0 - - function anotherServerDone (number, app, url) { - apps[number - 1] = app - urls[number - 1] = url - i++ - if (i === total_servers) { - serversRun(apps, urls) - } - } - - flushTests(function () { - for (var j = 1; j <= total_servers; j++) { - (function (k) { // TODO: ES6 with let - // For the virtual buffer - setTimeout(function () { - runServer(k, function (app, url) { - anotherServerDone(k, app, url) - }) - }, 1000 * k) - })(j) - } - }) - } - - function runServer (number, callback) { - var port = 9000 + number - var server_run_string = { - 'Connected to mongodb': false, - 'Server listening on port': false - } - - // Share the environment - var env = Object.create(process.env) - env.NODE_ENV = 'test' - env.NODE_APP_INSTANCE = number - var options = { - silent: true, - env: env, - detached: true - } - - var app = fork(__dirname + '/../server.js', [], options) - app.stdout.on('data', function onStdout (data) { - var dont_continue = false - // Check if all required sentences are here - for (var key of Object.keys(server_run_string)) { - if (data.toString().indexOf(key) !== -1) server_run_string[key] = true - if (server_run_string[key] === false) dont_continue = true - } - - // If no, there is maybe one thing not already initialized (mongodb...) - if (dont_continue === true) return - - app.stdout.removeListener('data', onStdout) - callback(app, 'http://localhost:' + port) - }) - } - - function flushTests (callback) { - exec(__dirname + '/../scripts/clean_test.sh', function () { - callback() - }) - } - - module.exports = { - flushTests: flushTests, - runMultipleServers: runMultipleServers, - runServer: runServer - } -})() -- cgit v1.2.3