import test from "ava";
|
import {isLeapYear} from "../../src/lib/chronos.js";
|
|
test( "isLeapYear", t => {
|
let year = [1900, 1904, 1908, 2000, 2004, 2005];
|
let expected = [false, true, true, true, true, false];
|
for(const [i,y] of Object.entries(year) ) {
|
let calculatedLeapYear = isLeapYear(y);
|
let leapYear = expected[i];
|
let message = `expected that the year ${y} is ${leapYear?' a' : ' not a'} leap year`
|
t.is(calculatedLeapYear, expected[i], message)
|
}
|
});
|
|
// Code-Comprehension Exercise: proof that the function `weekDayOfDate` only return integers in
|
// interval [0;6].
|
|
|
// Unit-Test Exercises: Make Unit Test for other functions
|
|
// Exercise 1: assert that `countDaysOfMonth` works for leap years (for example 2032)
|
|
// Exercise 2: assert that `weekDayOfDate` works for leap years
|