Skip to content

Commit

Permalink
added schedule unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Jan 4, 2015
1 parent 9a27732 commit 38f336a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/unit/shedule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* jshint expr:true */

'use strict';

var expect = require('chai').expect,
cp = require('child_process'),
h = require('../helpers/helpers'),
Schedule = require('../../server/models/schedule'),
Lab = require('lab'),
lab = exports.lab = Lab.script(),
describe = lab.describe,
it = lab.it,
beforeEach = lab.beforeEach,
db = h.getdb();

describe('Schedule', function(){
beforeEach(function(done){
cp.execFile(__dirname + '/../scripts/clean-db.sh', [db], {cwd:__dirname + '/../scripts'}, function(err, stdout, stderr){
if(err){console.log(err, stdout, stderr);}
done();
});
});

describe('.addDay', function(){
it('should add a day to the database', function(done){
var workoutId = 1,
userId = 1,
phaseId = 1,
date = new Date(2015,1,1),
input = {userId: userId, workoutId: workoutId, phaseId: phaseId, date:date};
Schedule.addDay(input, function(err, id){
expect(err).to.not.be.ok;
expect(id).to.be.ok;
done();
});
});
});

});
/*
describe('', function(){
it('should ', function(done){
});
});
*/

0 comments on commit 38f336a

Please sign in to comment.