Created
March 10, 2012 19:40
-
-
Save lele85/2012643 to your computer and use it in GitHub Desktop.
Pomodoro Test in nodeJS con WRU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wru.test([ | |
{ | |
name: "Can create a pomodoro", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
//Act | |
var p = pomodoroFactory.create({}); | |
//Assert | |
wru.assert(p !== undefined); | |
} | |
}, | |
{ | |
name: "Fresh pomodoro should have 1 sec duration by default", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
//Act | |
var p = pomodoroFactory.create({}); | |
//Assert | |
wru.assert(p.duration() === "1 sec"); | |
} | |
}, | |
{ | |
name: "Pomodoro duration can be assigned at construction time", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
//Act | |
var p = pomodoroFactory.create({ | |
duration : 2000 | |
}); | |
//Assert | |
wru.assert(p.duration() === "2 sec"); | |
} | |
}, | |
{ | |
name: "Fresh pomodoro is not running", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
//Act | |
var p = pomodoroFactory.create({}); | |
//Assert | |
wru.assert(p.isRunning() === false); | |
} | |
}, | |
{ | |
name: "Fresh pomodoro can't be already finished", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
//Act | |
var p = pomodoroFactory.create({}); | |
//Assert | |
wru.assert(p.isFinished() === false); | |
} | |
}, | |
{ | |
name: "Can start a pomodoro", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
var p = pomodoroFactory.create({}); | |
//Act | |
p.start(); | |
} | |
}, | |
{ | |
name: "Pomodoro should stop himself after a given time", | |
test: function () { | |
//Arrange | |
var pomodoroFactory = require('../pomodoro'); | |
var p = pomodoroFactory.create({}); | |
//Act | |
p.start(async(function(){ | |
//Assert | |
assert(p.isFinished() === true); | |
})); | |
} | |
} | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment