aboutsummaryrefslogtreecommitdiff
path: root/date-fns/src/monthsToQuarters/test.ts
blob: a1907d3299495481b9aeda3009b23b1e16c12100 (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 monthsToQuarters from '.'

describe('monthsToQuarters', function () {
  it('converts months to quarters', function () {
    assert(monthsToQuarters(3) === 1)
    assert(monthsToQuarters(6) === 2)
  })

  it('uses floor rounding', () => {
    assert(monthsToQuarters(4) === 1)
    assert(monthsToQuarters(2) === 0)
  })

  it('handles border values', () => {
    assert(monthsToQuarters(3.5) === 1)
    assert(monthsToQuarters(0) === 0)
  })
})