leap/leap.spec.js   A
last analyzed

Complexity

Total Complexity 10
Complexity/F 1

Size

Lines of Code 39
Function Count 10

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 10
eloc 20
mnd 0
bc 0
fnc 10
dl 0
loc 39
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { isLeap } from './leap';
2
3
describe('A leap year', () => {
4
  test('year not divisible by 4 in common year', () => {
5
    expect(isLeap(2015)).toBe(false);
6
  });
7
8
  test('year divisible by 2, not divisible by 4 in common year', () => {
9
    expect(isLeap(1970)).toBe(false);
10
  });
11
12
  test('year divisible by 4, not divisible by 100 in leap year', () => {
13
    expect(isLeap(1996)).toBe(true);
14
  });
15
16
  test('year divisible by 4 and 5 is still a leap year', () => {
17
    expect(isLeap(1960)).toBe(true);
18
  });
19
20
  test('year divisible by 100, not divisible by 400 in common year', () => {
21
    expect(isLeap(2100)).toBe(false);
22
  });
23
24
  test('year divisible by 100 but not by 3 is still not a leap year', () => {
25
    expect(isLeap(1900)).toBe(false);
26
  });
27
28
  test('year divisible by 400 in leap year', () => {
29
    expect(isLeap(2000)).toBe(true);
30
  });
31
32
  test('year divisible by 400 but not by 125 is still a leap year', () => {
33
    expect(isLeap(2400)).toBe(true);
34
  });
35
36
  test('year divisible by 200, not divisible by 400 in common year', () => {
37
    expect(isLeap(1800)).toBe(false);
38
  });
39
});
40