2023-08-02 09:23:48 +03:00
|
|
|
import { roundTen } from '../../../shlink-web-component/src/utils/helpers/numbers';
|
2020-04-04 11:36:34 +03:00
|
|
|
|
|
|
|
describe('numbers', () => {
|
|
|
|
describe('roundTen', () => {
|
|
|
|
it('rounds provided number to the next multiple of ten', () => {
|
|
|
|
const expectationsPairs = [
|
2022-03-26 14:17:42 +03:00
|
|
|
[10, 10],
|
|
|
|
[12, 20],
|
|
|
|
[158, 160],
|
|
|
|
[5, 10],
|
|
|
|
[-42, -40],
|
2020-04-04 11:36:34 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
expect.assertions(expectationsPairs.length);
|
2022-03-26 14:17:42 +03:00
|
|
|
expectationsPairs.forEach(([number, expected]) => {
|
2020-04-04 11:36:34 +03:00
|
|
|
expect(roundTen(number)).toEqual(expected);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|