diff --git a/client.js b/client.js index f4edcae7..839635f9 100644 --- a/client.js +++ b/client.js @@ -638,7 +638,7 @@ function instanceManagement() { hash: modHashes[i].hash, } needle.post(config.masterIP + ":" + config.masterPort + '/api/checkMod', payload, function (err, response, body) { - if(err) throw err // Unable to contact master server! Please check your config.json. + if(err) console.log(new Error("Unable to contact master server! Please check your config.json.")); if(response && body && body == "found") { console.log("master has mod"); } else if (response && body && typeof body == "string") { @@ -649,8 +649,7 @@ function instanceManagement() { // response.body is a string which is a modName.zip var req = request.post("http://"+config.masterIP + ":" + config.masterPort + '/api/uploadMod', function (err, resp, body) { if (err) { - console.log('Error!'); - throw err + console.log(new Error("Unable to contact master server! Please check your config.json.")); } else { console.log('URL: ' + body); } diff --git a/sharedPlugins/researchSync/index.spec.js b/sharedPlugins/researchSync/index.spec.js index 6ca5e15b..eae51abc 100644 --- a/sharedPlugins/researchSync/index.spec.js +++ b/sharedPlugins/researchSync/index.spec.js @@ -13,24 +13,32 @@ describe("researchSync/index.js", ()=>{ let reSync = new researchSync({}, function(){}); let obj1 = { - a:[true, 0], - b:[true, 0], - c:[false, 0], - d:[false, 10], + a:{researched: true, level: 0}, + b:{researched: true, level: 0}, + c:{researched: false, level: 0}, + d:{researched: false, level: 10}, }; let obj2 = { - a:[true, 0], - b:[true, 1], - c:[false, 0], - e:[false, 50], + a:{researched: true, level: 0}, + b:{researched: true, level: 1}, + c:{researched: false, level: 0}, + e:{researched: false, level: 50}, }; assert(typeof reSync.filterResearchDiff == "function"); let diffResult = reSync.filterResearchDiff(obj1, obj2); + assert(diffResult.a === undefined); - assert(diffResult.b === [true, 1]); + + assert(diffResult.b !== undefined); + assert.equal(diffResult.b.researched, true); + assert.equal(diffResult.b.level, 1); + assert(diffResult.d === undefined); - assert(diffResult.e === [false, 50]); + + assert(diffResult.e !== undefined); + assert.equal(diffResult.e.researched, false); + assert.equal(diffResult.e.level, 50); }); it(".pollResearch() dumps a long Lua command", ()=>{ let reSync = new researchSync({}, io);