summaryrefslogtreecommitdiff
path: root/date-fns/src/hoursToMilliseconds/test.ts
blob: fdc426cdcdae51767bf661777a79d644e9ee74ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* eslint-env mocha */

import assert from 'assert'
import hoursToMilliseconds from '.'

describe('hoursToMilliseconds', function () {
  it('converts hours to milliseconds', function () {
    assert(hoursToMilliseconds(1) === 3600000)
    assert(hoursToMilliseconds(2) === 7200000)
  })

  it('uses floor rounding', () => {
    assert(hoursToMilliseconds(0.123456) === 444441)
  })

  it('handles border values', () => {
    assert(hoursToMilliseconds(1.5) === 5400000)
    assert(hoursToMilliseconds(0) === 0)
  })
})