I tried looking for the source, but I can not find which tell about create unit tests for decimal validators. If my code in component.ts like this
DecimalValidator(decimal: number): ValidatorFn {
return (control: AbstractControl): { [key: string]: boolean } | null => {
const value = control.value;
if (value.includes('.')) {
const valArray = value.split('.');
if (valArray[1].length > decimal) {
return { 'maxDecimal': true };
} else {
return null;
}
} else {
return null;
}
};
}
how do I write the unit test in component.spec.ts for this function?