From e2fb9d6a8da0c4fdd88463f80e359dc1985bdaf6 Mon Sep 17 00:00:00 2001 From: Amiram Wingarten Date: Sun, 10 Dec 2017 12:05:10 +0200 Subject: [PATCH] update tests dependencies and stabilize tests --- src/test/javascript/package.json | 10 +++++----- src/test/javascript/test/SyncNoWebsocket.js | 20 +++++++++++--------- src/test/javascript/test/util/Util.js | 12 ++++++------ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/test/javascript/package.json b/src/test/javascript/package.json index aaf1f5f..da69d13 100644 --- a/src/test/javascript/package.json +++ b/src/test/javascript/package.json @@ -3,14 +3,14 @@ "test": "mocha --timeout 20000" }, "devDependencies": { - "chai": "4.1.1", - "mocha": "3.5.0", + "chai": "4.1.2", + "mocha": "4.0.1", "promise": "8.0.1", "sleep": "5.1.1", "promise-timeout": "1.1.1", - "request": "2.81.0", - "request-promise": "4.2.1", - "ws": "3.1.0" + "request": "2.83.0", + "request-promise": "4.2.2", + "ws": "3.3.2" }, "dependencies": { "assert": "1.4.1" diff --git a/src/test/javascript/test/SyncNoWebsocket.js b/src/test/javascript/test/SyncNoWebsocket.js index f959fb3..c1fb008 100644 --- a/src/test/javascript/test/SyncNoWebsocket.js +++ b/src/test/javascript/test/SyncNoWebsocket.js @@ -73,16 +73,18 @@ describe('Sync Integration Test - no websocket', function () { form.append('file', fs.createReadStream(zipFilePath)); }).then(function () { // putting file that already exists should fail - return new Promise(function (resolve) { - let req = request.put(pathPrefix + modulePath + '/java/test.java', COMMON_OPTIONS, function (err, res) { - console.log("error: " + err); - console.log("res: " + res); - assert.ok(res); - assert.equal(res.statusCode, 403); - resolve(res); + setTimeout(function () { + return new Promise(function (resolve) { + let req = request.put(pathPrefix + modulePath + '/java/test.java', COMMON_OPTIONS, function (err, res) { + console.log("error: " + err); + console.log("res: " + res); + assert.ok(res); + assert.equal(res.statusCode, 403); + resolve(res); + }); + req.form().append('file', fs.createReadStream(zipFilePath)); }); - req.form().append('file', fs.createReadStream(zipFilePath)); - }); + }, 10); }).then(deletePath.bind(undefined, '/java/test.java', filePath)); }); diff --git a/src/test/javascript/test/util/Util.js b/src/test/javascript/test/util/Util.js index a380168..0cf0ecf 100644 --- a/src/test/javascript/test/util/Util.js +++ b/src/test/javascript/test/util/Util.js @@ -2,13 +2,13 @@ const fs = require('fs'); module.exports = { - deleteFolderRecursive: function (path) { - var that = this; + deleteFolderRecursive: function (path) { + let that = this; if (fs.existsSync(path)) { - fs.readdirSync(path).forEach(function(file,index){ - var curPath = path + "/" + file; + fs.readdirSync(path).forEach(function (file, index) { + let curPath = path + "/" + file; if (fs.lstatSync(curPath).isDirectory()) { // recurse - that.deleteFolderRecursive(curPath); + that.deleteFolderRecursive(curPath); } else { // delete file fs.unlinkSync(curPath); } @@ -17,4 +17,4 @@ module.exports = { } } -} \ No newline at end of file +}; \ No newline at end of file