Skip to content

Commit 19ff1ce

Browse files
committed
Complete leapYears
1 parent 6787f5e commit 19ff1ce

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

leapYears/leapYears.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const leapYears = function() {
1+
const leapYears = function (year) {
2+
return year % 4 === 0 ? (year % 100 === 0 ? (year % 400 === 0 ? true : false) : true) : false;
3+
};
24

3-
}
4-
5-
module.exports = leapYears
5+
module.exports = leapYears;

leapYears/leapYears.spec.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
const leapYears = require('./leapYears')
1+
const leapYears = require("./leapYears");
22

3-
describe('leapYears', function() {
4-
it('works with non century years', function() {
5-
expect(leapYears(1996)).toEqual(true);
6-
});
7-
xit('works with non century years', function() {
8-
expect(leapYears(1997)).toEqual(false);
9-
});
10-
xit('works with ridiculously futuristic non century years', function() {
11-
expect(leapYears(34992)).toEqual(true);
12-
});
13-
xit('works with century years', function() {
14-
expect(leapYears(1900)).toEqual(false);
15-
});
16-
xit('works with century years', function() {
17-
expect(leapYears(1600)).toEqual(true);
18-
});
19-
xit('works with century years', function() {
20-
expect(leapYears(700)).toEqual(false);
21-
});
3+
describe("leapYears", function () {
4+
it("works with non century years", function () {
5+
expect(leapYears(1996)).toEqual(true);
6+
});
7+
it("works with non century years", function () {
8+
expect(leapYears(1997)).toEqual(false);
9+
});
10+
it("works with ridiculously futuristic non century years", function () {
11+
expect(leapYears(34992)).toEqual(true);
12+
});
13+
it("works with century years", function () {
14+
expect(leapYears(1900)).toEqual(false);
15+
});
16+
it("works with century years", function () {
17+
expect(leapYears(1600)).toEqual(true);
18+
});
19+
it("works with century years", function () {
20+
expect(leapYears(700)).toEqual(false);
21+
});
2222
});

0 commit comments

Comments
 (0)