File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
- const leapYears = function ( ) {
2
-
1
+ const leapYears = function ( year ) {
2
+ if ( year % 100 === 0 && year % 400 === 0 ) {
3
+ return true ;
4
+ } else if ( year % 100 === 0 && year % 400 != 0 ) {
5
+ return false ;
6
+ } else if ( year % 4 === 0 ) {
7
+ return true ;
8
+ } else {
9
+ return false ;
10
+ }
3
11
} ;
4
12
5
13
// Do not edit below this line
Original file line number Diff line number Diff line change @@ -4,19 +4,19 @@ describe('leapYears', () => {
4
4
test ( 'works with non century years' , ( ) => {
5
5
expect ( leapYears ( 1996 ) ) . toBe ( true ) ;
6
6
} ) ;
7
- test . skip ( 'works with non century years' , ( ) => {
7
+ test ( 'works with non century years' , ( ) => {
8
8
expect ( leapYears ( 1997 ) ) . toBe ( false ) ;
9
9
} ) ;
10
- test . skip ( 'works with ridiculously futuristic non century years' , ( ) => {
10
+ test ( 'works with ridiculously futuristic non century years' , ( ) => {
11
11
expect ( leapYears ( 34992 ) ) . toBe ( true ) ;
12
12
} ) ;
13
- test . skip ( 'works with century years' , ( ) => {
13
+ test ( 'works with century years' , ( ) => {
14
14
expect ( leapYears ( 1900 ) ) . toBe ( false ) ;
15
15
} ) ;
16
- test . skip ( 'works with century years' , ( ) => {
16
+ test ( 'works with century years' , ( ) => {
17
17
expect ( leapYears ( 1600 ) ) . toBe ( true ) ;
18
18
} ) ;
19
- test . skip ( 'works with century years' , ( ) => {
19
+ test ( 'works with century years' , ( ) => {
20
20
expect ( leapYears ( 700 ) ) . toBe ( false ) ;
21
21
} ) ;
22
22
} ) ;
You can’t perform that action at this time.
0 commit comments