Skip to content

Instantly share code, notes, and snippets.

@lele85
Created March 10, 2012 19:40
Show Gist options
  • Save lele85/2012643 to your computer and use it in GitHub Desktop.
Save lele85/2012643 to your computer and use it in GitHub Desktop.
Pomodoro Test in nodeJS con WRU
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