I have just started exploring unit testing in angular. I have a function in .ts file
onValueChange(val: number): void {
this.formGroup.get(this.controlName).setValue(val);
}
I am trying to test if the controlName has the value passed in the onValueChange parameters
I tried this in the spec.ts file
it('form value should update from form changes', fakeAsync(() => {
onValueChange(5);
expect(component.formGroup.get(component.controlName)).toEqual(5);
}));
function onValueChange(val: number): void {
component.formGroup.get(component.controlName).setValue(val);
}
what am I doing wrong