Skip to content

Commit f4dd04b

Browse files
author
Edson Hilios
committed
Improve unit testing for new formatters ✌️
1 parent e746fe4 commit f4dd04b

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

test/unit/event_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ test('event.offset object has {seconds, minutes, hours, days, ' +
3737
ok(event.offset.hasOwnProperty('days'));
3838
ok(event.offset.hasOwnProperty('daysToWeek'));
3939
ok(event.offset.hasOwnProperty('daysToMonth'));
40-
ok(event.offset.hasOwnProperty('totalDays'));
4140
ok(event.offset.hasOwnProperty('weeks'));
41+
ok(event.offset.hasOwnProperty('weeksToMonth'));
4242
ok(event.offset.hasOwnProperty('years'));
43+
ok(event.offset.hasOwnProperty('totalDays'));
44+
ok(event.offset.hasOwnProperty('totalHours'));
45+
ok(event.offset.hasOwnProperty('totalMinutes'));
46+
ok(event.offset.hasOwnProperty('totalSeconds'));
4347
});
4448
$clock.tick(500);
4549
});

test/unit/math_test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ test('time offset calculation', function() {
1414
ok(event.offset.hours === 3);
1515
ok(event.offset.minutes === 4);
1616
ok(event.offset.seconds === 5);
17-
ok(event.offset.totalDays === 9);
17+
// Offset values
18+
ok(event.offset.daysToWeek === 2);
19+
ok(event.offset.daysToMonth === 9);
20+
ok(event.offset.weeksToMonth === 1);
21+
// Test total count
22+
ok(event.offset.totalDays === 9);
23+
ok(event.offset.totalHours === 9 * 24 + 3);
24+
ok(event.offset.totalMinutes === 9 * 24 * 60 + 3 * 60 + 4);
25+
ok(event.offset.totalSeconds === (9 * 24 * 60 + 3 * 60 + 4) * 60 + 5);
1826
});
1927

2028
$clock.tick(500);

0 commit comments

Comments
 (0)