leap years solution
This commit is contained in:
parent
c14e4628ec
commit
72878172b5
2 changed files with 7 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
var leapYears = function() {
|
var leapYears = function(year) {
|
||||||
|
return year % 4 === 0 && ( year % 100 !== 0 || year % 400 == 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = leapYears
|
module.exports = leapYears
|
||||||
|
|
|
@ -4,19 +4,19 @@ describe('leapYears', function() {
|
||||||
it('works with non century years', function() {
|
it('works with non century years', function() {
|
||||||
expect(leapYears(1996)).toEqual(true);
|
expect(leapYears(1996)).toEqual(true);
|
||||||
});
|
});
|
||||||
xit('works with non century years', function() {
|
it('works with non century years', function() {
|
||||||
expect(leapYears(1997)).toEqual(false);
|
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);
|
expect(leapYears(34992)).toEqual(true);
|
||||||
});
|
});
|
||||||
xit('works with century years', function() {
|
it('works with century years', function() {
|
||||||
expect(leapYears(1900)).toEqual(false);
|
expect(leapYears(1900)).toEqual(false);
|
||||||
});
|
});
|
||||||
xit('works with century years', function() {
|
it('works with century years', function() {
|
||||||
expect(leapYears(1600)).toEqual(true);
|
expect(leapYears(1600)).toEqual(true);
|
||||||
});
|
});
|
||||||
xit('works with century years', function() {
|
it('works with century years', function() {
|
||||||
expect(leapYears(700)).toEqual(false);
|
expect(leapYears(700)).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue