diff --git a/leapYears/leapYears.js b/leapYears/leapYears.js index 68e3af8..720c763 100644 --- a/leapYears/leapYears.js +++ b/leapYears/leapYears.js @@ -1,5 +1,11 @@ -const leapYears = function() { - +const leapYears = function (checkLeapYear) { + if (checkLeapYear % 100 === 0 && checkLeapYear % 400 === 0) { + return true; + } else if (checkLeapYear % 4 === 0 && checkLeapYear % 100 !== 0) { + return true; + } else { + return false; + } }; module.exports = leapYears; diff --git a/leapYears/leapYears.spec.js b/leapYears/leapYears.spec.js index 6fdaba9..d608639 100644 --- a/leapYears/leapYears.spec.js +++ b/leapYears/leapYears.spec.js @@ -1,22 +1,22 @@ -const leapYears = require('./leapYears') +const leapYears = require("./leapYears"); -describe('leapYears', () => { - test('works with non century years', () => { +describe("leapYears", () => { + test("works with non century years", () => { expect(leapYears(1996)).toBe(true); }); - test.skip('works with non century years', () => { + test("works with non century years", () => { expect(leapYears(1997)).toBe(false); }); - test.skip('works with ridiculously futuristic non century years', () => { + test("works with ridiculously futuristic non century years", () => { expect(leapYears(34992)).toBe(true); }); - test.skip('works with century years', () => { + test("works with century years", () => { expect(leapYears(1900)).toBe(false); }); - test.skip('works with century years', () => { + test("works with century years", () => { expect(leapYears(1600)).toBe(true); }); - test.skip('works with century years', () => { + test("works with century years", () => { expect(leapYears(700)).toBe(false); }); });