Trying to write an unit test for changeFunctionalityStatus(). facing the issue like fControl.get is not a function . Stuck with this Anyone pls help me why this issue coming. TIA
changeFunctionalityStatus(fControl: FormControl, screen) {
if (this.isConsult) return;
const isFuncActivated = fControl.get('isFunctionalityActivatedController').value;
if (fControl.value.functionalityCodeController == "CONSULT_PROJECT" || fControl.value.functionalityCodeController == "CONSULT_BUSINESS_OFFER" || fControl.value.functionalityCodeController == "CONSULT_PROJECT_CONTRACT" || fControl.value.functionalityCodeController == "CONSULT_BILLING_LIST" || fControl.value.functionalityCodeController == "CONSULT_PROJECT_INVOICES" || fControl.value.functionalityCodeController == "CONSULT_CONTRACT" || fControl.value.functionalityCodeController == "CONSULT_MILESTONE") {
this.removeFunctionalitiesByScreen(screen);
}
if (isFuncActivated) {
this.removeFunctionality(fControl);
} else {
this.addFunctionality(fControl);
}
this.checkAndSetScreenAccessController(screen);
}
spec.ts
it('changeFunctionalityStatus', () => {
spyOn(component, 'changeFunctionalityStatus').and.callThrough();
component.changeFunctionalityStatus({} as FormControl,"mockscreen");
expect(component.changeFunctionalityStatus).toHaveBeenCalled();
});