import { roundUpWithoutDecimal, roundDownWithoutDecimal, roundNumberWithDecimal, } from './number.util'; describe('roundUpWithoutDecimal', () => { it('should round up a number to the nearest whole number without decimal places', () => { expect(roundUpWithoutDecimal(123.45)).toBe(124); expect(roundUpWithoutDecimal(123)).toBe(123); }); }); describe('roundDownWithoutDecimal', () => { it('should round down a number to the nearest whole number without decimal places', () => { expect(roundDownWithoutDecimal(3.14)).toBe(3); expect(roundDownWithoutDecimal(5.678)).toBe(5); expect(roundDownWithoutDecimal(10)).toBe(10); }); }); describe('roundNumberWithDecimal', () => { it('should round a number to the specified number of decimal places', () => { expect(roundNumberWithDecimal(3.14159, 2)).toBe(3.14); expect(roundNumberWithDecimal(5.678, 1)).toBe(5.7); expect(roundNumberWithDecimal(10, 0)).toBe(10); expect(roundNumberWithDecimal(10.123456789, 4)).toBe(10.1235); expect(roundNumberWithDecimal(135.795, 2)).toBe(135.8); expect(roundNumberWithDecimal(135.795763, 2)).toBe(135.8); }); });