import { RoundingFunctions, } from './rounding.functions'; describe('roundToDps', () => { // tslint:disable-next-line test('It rounds up simple numbers', () => { const result = RoundingFunctions.roundToDps( 1.05, 1, ); expect(result).toBe(1.1); }); // tslint:disable-next-line test('It rounds down simple numbers', () => { const result = RoundingFunctions.roundToDps( 1.04999, 1, ); expect(result).toBe(1); }); // tslint:disable-next-line test('It rounds very large numbers', () => { const result = RoundingFunctions.roundToDps( 1.555555555555555555555555555, 10, ); expect(result).toBe( 1.5555555556, ); }); // tslint:disable-next-line test('If there are less decimals in the number than asked for, it returns that number', () => { const result = RoundingFunctions.roundToDps( 1.55, 10, ); expect(result).toBe(1.55); }); // tslint:disable-next-line test('If the value is already an expotential it returns the correct number', () => { const result = RoundingFunctions.roundToDps( 5.684341886080802e-14, 10, ); expect(result).toBe(0); }); });