From b3077e417056f18225957f65419b87de72117fe3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 7 Feb 2016 10:39:37 +0100 Subject: Standard v6 --- tests/api/checkParams.js | 19 ++++++++++--------- tests/api/multiplePods.js | 3 ++- tests/api/singlePod.js | 5 +++-- tests/api/utils.js | 7 ++++--- 4 files changed, 19 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/api/checkParams.js b/tests/api/checkParams.js index 11fc68ff9..8ce1bd476 100644 --- a/tests/api/checkParams.js +++ b/tests/api/checkParams.js @@ -4,6 +4,7 @@ var async = require('async') var chai = require('chai') var expect = chai.expect + var pathUtils = require('path') var request = require('supertest') var utils = require('./utils') @@ -119,7 +120,7 @@ describe('When searching a video', function () { it('Should fail with nothing', function (done) { request(url) - .get(path + '/search/') + .get(pathUtils.join(path, 'search')) .set('Accept', 'application/json') .expect(400, done) }) @@ -137,7 +138,7 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/fixtures/video_short.webm' + 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') } makePostRequest(path, data, attach, done) }) @@ -148,7 +149,7 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/fixtures/video_short.webm' + 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') } makePostRequest(path, data, attach, done) }) @@ -158,7 +159,7 @@ name: 'my super name' } var attach = { - 'input_video': __dirname + '/fixtures/video_short.webm' + 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') } makePostRequest(path, data, attach, done) }) @@ -171,7 +172,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': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') } makePostRequest(path, data, attach, done) }) @@ -191,7 +192,7 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/../fixtures/video_short_fake.webm' + 'input_video': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') } makePostRequest(path, data, attach, done) }) @@ -202,12 +203,12 @@ description: 'my super description' } var attach = { - 'input_video': __dirname + '/fixtures/video_short.webm' + 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') } makePostRequest(path, data, attach, function () { - attach.input_video = __dirname + '/fixtures/video_short.mp4' + attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') makePostRequest(path, data, attach, function () { - attach.input_video = __dirname + '/fixtures/video_short.ogv' + attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') makePostRequest(path, data, attach, done, true) }, true) }, true) diff --git a/tests/api/multiplePods.js b/tests/api/multiplePods.js index 5070b450a..7949da80a 100644 --- a/tests/api/multiplePods.js +++ b/tests/api/multiplePods.js @@ -4,9 +4,10 @@ var async = require('async') var chai = require('chai') var expect = chai.expect + var pathUtils = require('path') var utils = require('./utils') - var webtorrent = require(__dirname + '/../../lib/webtorrent') + var webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) webtorrent.silent = true describe('Test multiple pods', function () { diff --git a/tests/api/singlePod.js b/tests/api/singlePod.js index e5337256b..f33aa8c7a 100644 --- a/tests/api/singlePod.js +++ b/tests/api/singlePod.js @@ -5,8 +5,9 @@ var chai = require('chai') var expect = chai.expect var fs = require('fs') + var pathUtils = require('path') - var webtorrent = require(__dirname + '/../../lib/webtorrent') + var webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) webtorrent.silent = true var utils = require('./utils') @@ -112,7 +113,7 @@ utils.removeVideo(url, video_id, function (err) { if (err) throw err - fs.readdir(__dirname + '/../../test1/uploads/', function (err, files) { + fs.readdir(pathUtils.join(__dirname, '../../test1/uploads/'), function (err, files) { if (err) throw err expect(files.length).to.equal(0) diff --git a/tests/api/utils.js b/tests/api/utils.js index a1996b4d7..b71e943ed 100644 --- a/tests/api/utils.js +++ b/tests/api/utils.js @@ -4,6 +4,7 @@ var child_process = require('child_process') var exec = child_process.exec var fork = child_process.fork + var pathUtils = require('path') var request = require('supertest') var testUtils = { @@ -22,7 +23,7 @@ // ---------------------- Export functions -------------------- function flushTests (callback) { - exec(__dirname + '/../../scripts/clean_test.sh', callback) + exec(pathUtils.join(__dirname, '../../scripts/clean_test.sh'), callback) } function getFriendsList (url, end) { @@ -139,7 +140,7 @@ detached: true } - var app = fork(__dirname + '/../../server.js', [], options) + var app = fork(pathUtils.join(__dirname, '../../server.js'), [], options) app.stdout.on('data', function onStdout (data) { var dont_continue = false // Check if all required sentences are here @@ -175,7 +176,7 @@ .set('Accept', 'application/json') .field('name', name) .field('description', description) - .attach('input_video', __dirname + '/fixtures/' + fixture) + .attach('input_video', pathUtils.join(__dirname, 'fixtures', fixture)) .expect(201) .end(end) } -- cgit v1.2.3