change decimal places description

This commit is contained in:
nanov 2019-10-21 10:29:29 +03:00
parent d761b8f7a2
commit b83a972b4a
2 changed files with 3 additions and 3 deletions

View File

@ -362,7 +362,7 @@ describe('Utils', () => {
it('should have a humanized constraint when multipleOf is set, and it is in format of /^0\\.0*1$/', () => { it('should have a humanized constraint when multipleOf is set, and it is in format of /^0\\.0*1$/', () => {
expect(humanizeConstraints(itemConstraintSchema(undefined, undefined, 0.01))).toContain( expect(humanizeConstraints(itemConstraintSchema(undefined, undefined, 0.01))).toContain(
'decimals <= 2 digits', 'decimal places <= 2',
); );
}); });

View File

@ -374,9 +374,9 @@ function humanizeMultipleOfConstraint(multipleOf: number | undefined): string |
} }
const strigifiedMultipleOf = multipleOf.toString(10); const strigifiedMultipleOf = multipleOf.toString(10);
if (!/^0\.0*1$/.test(strigifiedMultipleOf)) { if (!/^0\.0*1$/.test(strigifiedMultipleOf)) {
return `multiple of ${multipleOf}`; return `multiple of ${strigifiedMultipleOf}`;
} }
return `decimals <= ${strigifiedMultipleOf.split('.')[1].length} digits`; return `decimal places <= ${strigifiedMultipleOf.split('.')[1].length} digits`;
} }
function humanizeRangeConstraint( function humanizeRangeConstraint(