Skip to content

Commit

Permalink
fixes #78 : Add UnitTests for modules
Browse files Browse the repository at this point in the history
Refactoring modules in preparation of unit test creation
  • Loading branch information
remie committed Sep 17, 2015
1 parent 7881016 commit a528bbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var schedule = require('node-schedule');
// ------------------------------------------------------------------------------------------ Module definition

function Scheduler() {
this.schedules = [];
this.schedules = new Array();
};

Scheduler.prototype.get = function(name) {
Expand All @@ -34,10 +34,12 @@ Scheduler.prototype.clear = function(name) {
this.schedules[name].cancel();
this.schedules = _.remove(this.schedules, this.schedules[name]);
} else {
_.each(this.schedules, function(schedule) {
for(var name in this.schedules) {
var schedule = this.schedules[name];
schedule.cancel();
});
this.schedules = Array();
delete this.schedules[name];
};
this.schedules = new Array();
}
return true;
};
Expand Down
4 changes: 2 additions & 2 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Settings.prototype.get = function(next) {
var settings = JSON.parse(content);
var output = _.assign(config, settings);

if(!path.isAbsolute(output.localstoragepath)) {
output.localstoragepath = path.resolve(nconf.get('basedir'), output.localstoragepath);
if(output.localstoragepath && !path.isAbsolute(output.localstoragepath)) {
output.localstoragepath = path.resolve(output.basedir, output.localstoragepath);
}

next(null, output);
Expand Down

0 comments on commit a528bbb

Please sign in to comment.