@aller/blink
Version:
A library for tracking user behaviour.
20 lines (15 loc) • 434 B
text/typescript
import { round } from '../round';
describe('round', () => {
it('should round to two decimals', () => {
expect(round(25.888, 2)).toBe(25.89);
});
it('should default to zero decimals', () => {
expect(round(12)).toBe(12);
});
it('should round int to float', () => {
expect(round(150, 3)).toBe(150.0);
});
it('should round down when that makes sense', () => {
expect(round(1.12, 1)).toBe(1.1);
});
});