|
1 | 1 | import { Gigasecond } from './gigasecond' |
2 | 2 |
|
3 | 3 | describe('Gigasecond', () => { |
4 | | - it('tells a gigasecond anniversary since midnight', () => { |
5 | | - const gs = new Gigasecond(new Date(Date.UTC(2015, 8, 14))) |
6 | | - const expectedDate = new Date(Date.UTC(2047, 4, 23, 1, 46, 40)) |
| 4 | + it('date only specification of time', () => { |
| 5 | + const gs = new Gigasecond(new Date(Date.parse('2011-04-25'))) |
| 6 | + const expectedDate = new Date(Date.parse('2043-01-01T01:46:40Z')) |
7 | 7 | expect(gs.date()).toEqual(expectedDate) |
8 | 8 | }) |
9 | 9 |
|
10 | | - xit('tells the anniversary is next day when you are born at night', () => { |
11 | | - const gs = new Gigasecond(new Date(Date.UTC(2015, 8, 14, 23, 59, 59))) |
12 | | - const expectedDate = new Date(Date.UTC(2047, 4, 24, 1, 46, 39)) |
| 10 | + xit('second test for date only specification of time', () => { |
| 11 | + const gs = new Gigasecond(new Date(Date.parse('1977-06-13'))) |
| 12 | + const expectedDate = new Date(Date.parse('2009-02-19T01:46:40Z')) |
13 | 13 | expect(gs.date()).toEqual(expectedDate) |
14 | 14 | }) |
15 | 15 |
|
16 | | - xit('even works before 1970 (beginning of Unix epoch )', () => { |
17 | | - const gs = new Gigasecond(new Date(Date.UTC(1959, 6, 19, 5, 13, 45))) |
18 | | - const expectedDate = new Date(Date.UTC(1991, 2, 27, 7, 0, 25)) |
| 16 | + xit('third test for date only specification of time', () => { |
| 17 | + const gs = new Gigasecond(new Date(Date.parse('1959-07-19'))) |
| 18 | + const expectedDate = new Date(Date.parse('1991-03-27T01:46:40Z')) |
19 | 19 | expect(gs.date()).toEqual(expectedDate) |
20 | 20 | }) |
21 | 21 |
|
22 | | - xit('make sure calling "date" doesn\'t mutate value', () => { |
23 | | - const gs = new Gigasecond(new Date(Date.UTC(1959, 6, 19, 5, 13, 45))) |
24 | | - const expectedDate = new Date(Date.UTC(1991, 2, 27, 7, 0, 25)) |
| 22 | + xit('full time specified', () => { |
| 23 | + const gs = new Gigasecond(new Date(Date.parse('2015-01-24T22:00:00Z'))) |
| 24 | + const expectedDate = new Date(Date.parse('2046-10-02T23:46:40Z')) |
| 25 | + expect(gs.date()).toEqual(expectedDate) |
| 26 | + }) |
| 27 | + |
| 28 | + xit('full time with day roll-over', () => { |
| 29 | + const gs = new Gigasecond(new Date(Date.parse('2015-01-24T23:59:59Z'))) |
| 30 | + const expectedDate = new Date(Date.parse('2046-10-03T01:46:39Z')) |
| 31 | + expect(gs.date()).toEqual(expectedDate) |
| 32 | + }) |
| 33 | + |
| 34 | + xit('does not mutate the input', () => { |
| 35 | + const gs = new Gigasecond(new Date(Date.parse('2015-01-24T23:59:59Z'))) |
| 36 | + const expectedDate = new Date(Date.parse('2046-10-03T01:46:39Z')) |
25 | 37 | gs.date() |
26 | 38 | expect(gs.date()).toEqual(expectedDate) |
27 | 39 | }) |
|
0 commit comments