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

import assert from 'assert'
import yearsToMonths from '.'

describe('yearsToMonths', function () {
  it('converts years to months', function () {
    assert(yearsToMonths(1) === 12)
    assert(yearsToMonths(2) === 24)
  })

  it('uses floor rounding', () => {
    assert(yearsToMonths(1.7) === 20)
    assert(yearsToMonths(0.1) === 1)
  })

  it('handles border values', () => {
    assert(yearsToMonths(1.5) === 18)
    assert(yearsToMonths(0) === 0)
  })
})