From 72878172b5ddb710a0ad98336c3636f006b7ca04 Mon Sep 17 00:00:00 2001 From: Cody Loyd Date: Thu, 14 Dec 2017 15:35:45 -0600 Subject: [PATCH] leap years solution --- leapYears/leapYears.js | 4 ++-- leapYears/leapYears.spec.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/leapYears/leapYears.js b/leapYears/leapYears.js index 7884b78..f6b3e00 100644 --- a/leapYears/leapYears.js +++ b/leapYears/leapYears.js @@ -1,5 +1,5 @@ -var leapYears = function() { - +var leapYears = function(year) { + return year % 4 === 0 && ( year % 100 !== 0 || year % 400 == 0) } module.exports = leapYears diff --git a/leapYears/leapYears.spec.js b/leapYears/leapYears.spec.js index b58dadb..0af23c3 100644 --- a/leapYears/leapYears.spec.js +++ b/leapYears/leapYears.spec.js @@ -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); }); });