gigasecond/gigasecond.spec.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 21
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 14
mnd 0
bc 0
fnc 4
dl 0
loc 21
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { gigasecond } from './gigasecond';
2
3
describe('Gigasecond', () => {
4
  test('tells a gigasecond anniversary since midnight', () => {
5
    const gs = gigasecond(new Date(Date.UTC(2015, 8, 14)));
6
    const expectedDate = new Date(Date.UTC(2047, 4, 23, 1, 46, 40));
7
    expect(gs).toEqual(expectedDate);
8
  });
9
10
  test('tells the anniversary is next day when you are born at night', () => {
11
    const gs = gigasecond(new Date(Date.UTC(2015, 8, 14, 23, 59, 59)));
12
    const expectedDate = new Date(Date.UTC(2047, 4, 24, 1, 46, 39));
13
    expect(gs).toEqual(expectedDate);
14
  });
15
16
  test('even works before 1970 (beginning of Unix epoch)', () => {
17
    const gs = gigasecond(new Date(Date.UTC(1959, 6, 19, 5, 13, 45)));
18
    const expectedDate = new Date(Date.UTC(1991, 2, 27, 7, 0, 25));
19
    expect(gs).toEqual(expectedDate);
20
  });
21
});
22