Sha256: 76b9ba19a16d86193237bfa92330ede76d1a12617907a3f1249cfb3a0538573d

Contents?: true

Size: 1.09 KB

Versions: 224

Compression:

Stored size: 1.09 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

224 entries across 224 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.138 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.137 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.136 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.135 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.134 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.133 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.132 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.131 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.130 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.129 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.128 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.127 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.126 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.125 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.124 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.123 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.122 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.121 tracks/typescript/exercises/gigasecond/gigasecond.test.ts
trackler-2.2.1.120 tracks/typescript/exercises/gigasecond/gigasecond.test.ts