Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
update tests dependencies and stabilize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amiramw committed Dec 10, 2017
1 parent 02f0560 commit e2fb9d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/test/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 11 additions & 9 deletions src/test/javascript/test/SyncNoWebsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

Expand Down
12 changes: 6 additions & 6 deletions src/test/javascript/test/util/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -17,4 +17,4 @@ module.exports = {
}
}

}
};

0 comments on commit e2fb9d6

Please sign in to comment.