diff options
Diffstat (limited to 'date-fns/src/monthsToQuarters/test.ts')
-rw-r--r-- | date-fns/src/monthsToQuarters/test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/date-fns/src/monthsToQuarters/test.ts b/date-fns/src/monthsToQuarters/test.ts new file mode 100644 index 0000000..a1907d3 --- /dev/null +++ b/date-fns/src/monthsToQuarters/test.ts @@ -0,0 +1,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) + }) +}) |