import cleanNumericValue from '../cleanNumericValue'; test('default allows nothing', () => { const cleanNumericValue1 = cleanNumericValue({ value: '1,000.10' }); expect(cleanNumericValue1).toEqual('1000'); }); test('removes commas', () => { const cleanNumericValue1 = cleanNumericValue({ value: '1,000' }); expect(cleanNumericValue1).toEqual('1000'); const cleanNumericValue2 = cleanNumericValue({ value: '1,000,000' }); expect(cleanNumericValue2).toEqual('1000000'); }); test('should allow decimals when allowDecimal is true', () => { const cleanNumericValue1 = cleanNumericValue({ value: '1,000.10', allowDecimal: true }); expect(cleanNumericValue1).toEqual('1000.10'); }); test('should only allow 2 decimals when allowDecimal is true', () => { const cleanNumericValue1 = cleanNumericValue({ value: '1,000.1010', allowDecimal: true }); expect(cleanNumericValue1).toEqual('1000.10'); });