Skip to content

Commit

Permalink
fix tests, added vagrant
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Alabor committed May 5, 2014
1 parent a156c5f commit cac0d5f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.DS_Store
.vagrant/
9 changes: 9 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"

config.vm.synced_folder "./", "/home/vagrant/powerbuddy"

end
27 changes: 24 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var spawn = require('child_process').spawn
, at = spawn('at', ['6:55AM', '15.01.2014']);
/*var spawn = require('child_process').spawn
, at = spawn('at', ['7:14AM', '23.04.2014']);
at.stdin.setEncoding('utf-8');
at.stdin.write('subl', function() {
Expand All @@ -22,4 +22,25 @@ at.stderr.on('data', function(data) {
at.on('close', function(signal) {
console.log('signal: ', signal);
});
});*/

var days = require('./lib/model/days')
, factory = require('./test/lib/fakeFactory')
, Time = require('time-js')
, Scheduler = require('./lib/scheduler')
, Task = require('./lib/model/task')
, schedule = factory.createSchedule([
factory.createTask(
days.monday, new Time('07:30am'), Task.prototype.START)
])
, fakeAdapter = function fakeAdapter(task, callback) {
console.log('>>>>>>>>>> fakeAdapter', task);
}
, scheduler = new Scheduler(schedule, fakeAdapter, fakeAdapter);

scheduler.scheduleNextUpcomingShutdown(function(err) {
console.log(err);
});
scheduler.scheduleNextUpcomingStart(function(err) {
console.log(err);
});
6 changes: 3 additions & 3 deletions test/lib/fakeFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ function createSchedule(tasks) {
return schedule;
}

function createScheduler() {
var schedule = createSchedule()
, fakeAdapter = function(task, callback) {
function createScheduler(schedule) {
schedule = schedule || createSchedule();
var fakeAdapter = function(task, callback) {
callback(null);
}
, scheduler = new Scheduler(
Expand Down

0 comments on commit cac0d5f

Please sign in to comment.