Sha256: 4679b99312148e26a0d6a17cb6b7508d22e39481123ff32da4776ceb7e99bf8b

Contents?: true

Size: 1.08 KB

Versions: 71

Compression:

Stored size: 1.08 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)
  })

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

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

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

71 entries across 71 versions & 1 rubygems

Version Path
trackler-2.1.0.16 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.15 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.14 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.13 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.12 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.11 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.10 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.9 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.8 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.7 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.6 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.5 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.4 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.3 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.2 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.1 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.1.0.0 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.0.8.55 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.0.8.54 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.0.8.53 tracks/typescript/exercises/gigasecond/gigasecond.test.ts