From 513646cebfd75bf3a4bc9063633538116653e6d9 Mon Sep 17 00:00:00 2001 From: Justin O'Reilly Date: Fri, 21 May 2021 18:41:06 -0400 Subject: [PATCH] changes to jest --- leapYears/leapYears.js | 10 ++++++++-- leapYears/leapYears.spec.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) 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); }); });