@erfffun/utils
Version:
Energi javascript utilities for web development
20 lines (15 loc) • 544 B
JavaScript
/* global describe, test, expect */
import { isValidFloat, isValidInteger } from '../index';
describe('Testing validation of nummeric inputs', () => {
test('checking if it is integer', () => {
expect(isValidInteger('1', { onlyPositive: true })).toBe(true);
});
test('checking if it is not integer', () => {
expect(isValidInteger('0.1', { onlyPositive: true })).toBe(false);
});
test('checking if it is float', () => {
expect(
isValidFloat('0.1', { onlyPositive: true, acceptTrailingDecimal: false }),
).toBe(true);
});
});