kibana/packages/kbn-tinymath/test/functions/fix.test.js
Wylie Conlon ac39321fc5
Tinymath is now a Kibana package (#89383)
* Tinymath is now a Kibana package

* Rename to @kbn/tinymath

* Update import style

* Update README

* Use commonjs import syntax

* Fix to commonjs export

* More commonjs fixes
2021-01-28 13:58:37 -05:00

22 lines
738 B
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/
const { fix } = require('../../src/functions/fix.js');
describe('Fix', () => {
it('numbers', () => {
expect(fix(-10.5)).toEqual(-10);
expect(fix(-10.1)).toEqual(-10);
expect(fix(10.9)).toEqual(10);
});
it('arrays', () => {
expect(fix([-10.5, -20.9, -30.1, -40.2])).toEqual([-10, -20, -30, -40]);
expect(fix([2.9, 5.1, 3.5, 4.3])).toEqual([2, 5, 3, 4]);
});
});