Sha256: 3e856ca6081f8dca4e185fa8fad694464d3b96d12a898b1d86be1deb8bc782a2

Contents?: true

Size: 1.11 KB

Versions: 185

Compression:

Stored size: 1.11 KB

Contents

import Gigasecond from './gigasecond';

describe('Gigasecond', () => {
  test('tells a gigasecond anniversary since midnight', () => {
    const gs = new Gigasecond(new Date(Date.UTC(2015, 8, 14)));
    const expectedDate = new Date(Date.UTC(2047, 4, 23, 1, 46, 40));
    expect(gs.date()).toEqual(expectedDate);
  });

  xtest('tells the anniversary is next day when you are born at night', () => {
    const gs = new Gigasecond(new Date(Date.UTC(2015, 8, 14, 23, 59, 59)));
    const expectedDate = new Date(Date.UTC(2047, 4, 24, 1, 46, 39));
    expect(gs.date()).toEqual(expectedDate);
  });

  xtest('even works before 1970 (beginning of Unix epoch)', () => {
    const gs = new Gigasecond(new Date(Date.UTC(1959, 6, 19, 5, 13, 45)));
    const expectedDate = new Date(Date.UTC(1991, 2, 27, 7, 0, 25));
    expect(gs.date()).toEqual(expectedDate);
  });

  xtest('make sure calling "date" doesn\'t mutate value', () => {
    const gs = new Gigasecond(new Date(Date.UTC(1959, 6, 19, 5, 13, 45)));
    const expectedDate = new Date(Date.UTC(1991, 2, 27, 7, 0, 25));
    gs.date();
    expect(gs.date()).toEqual(expectedDate);
  });
});

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.179 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.178 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.177 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.176 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.175 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.174 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.173 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.172 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.171 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.170 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.169 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.167 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.166 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.165 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.164 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.163 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.162 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.161 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.2.1.160 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js