|
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
|
|
|
|