Sha256: 524d2d7ff39fb68ac37c410f1202f396dfbc6851d498bd900a961b13cfd5ace5

Contents?: true

Size: 1.11 KB

Versions: 208

Compression:

Stored size: 1.11 KB

Contents

import Gigasecond from './gigasecond';

describe('Gigasecond', () => {

  it('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);
  });

  xit('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);
  });

  xit('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);
  });

  xit('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

208 entries across 208 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.52 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.51 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.50 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.49 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.48 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.47 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.46 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.45 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.44 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.43 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.42 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.41 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.40 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.39 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.38 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.37 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.36 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.34 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js
trackler-2.1.0.33 tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js