solved leapYears.js

This commit is contained in:
Salih 2020-07-16 21:20:06 +02:00
parent c202bb4a00
commit bdf2834cec
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,13 @@
const leapYears = function() {
const leapYears = function(year) {
if(year%4==0 && year%100!=0){
return true;
}
else if(year%400==0){
return true;
}
else{
return false;
}
}
module.exports = leapYears

View File

@ -4,19 +4,19 @@ describe('leapYears', function() {
it('works with non century years', function() {
expect(leapYears(1996)).toEqual(true);
});
xit('works with non century years', function() {
it('works with non century years', function() {
expect(leapYears(1997)).toEqual(false);
});
xit('works with ridiculously futuristic non century years', function() {
it('works with ridiculously futuristic non century years', function() {
expect(leapYears(34992)).toEqual(true);
});
xit('works with century years', function() {
it('works with century years', function() {
expect(leapYears(1900)).toEqual(false);
});
xit('works with century years', function() {
it('works with century years', function() {
expect(leapYears(1600)).toEqual(true);
});
xit('works with century years', function() {
it('works with century years', function() {
expect(leapYears(700)).toEqual(false);
});
});