Commit 481d2472 authored by Sebastian Pekarek's avatar Sebastian Pekarek
Browse files

ICalTools tests / fix

parent d26a3ca6
......@@ -64,8 +64,8 @@ module.exports.duration = function duration(seconds) {
if(seconds > 0) {
string += seconds + 'S';
}
else if(!string) {
string = '0S';
else if(string.length <= 2) {
string += '0S';
}
return string;
......
......@@ -6,6 +6,19 @@ var assert = require('assert'),
describe('ical-generator 0.2.x / ICalCalendar', function() {
'use strict';
describe('ICalTools', function() {
describe('duration()', function() {
it('case #1', function() {
var tools = require(__dirname + '/../lib/_tools.js');
assert.equal(tools.duration(5425), 'PT1H30M25S');
});
it('case #2', function() {
var tools = require(__dirname + '/../lib/_tools.js');
assert.equal(tools.duration(0), 'PT0S');
});
});
});
describe('ICalCalendar', function() {
describe('domain()', function() {
it('setter should return this', function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment