I'm trying to test a function that is initiated by a button click

If the button value equals "Yes" apply a custom validator to a formGroup

The validator requires a parameter which is a service "this.stateService", which returns a number "0" for this test.

Actual function:

```
  onSelected(): void {
        const myFormGroup: AbstractControl = this.form.controls.fGroup;
            if (this.form.get('button').value === 'Yes') {
                myFormGroup.validator = myValidation.requireCheckboxesToBeChecked(this.stateService);
                } else {
                myFormGroup.setValidators(null);
                }
            myFormGroup.updateValueAndValidity();
    }

```

In the validator file:

```
static requireCheckboxesToBeChecked(stateService: StateService): ValidatorFn {
    return function validate (formGroup: FormGroup): { [key: string]: boolean } | null  {
      const checkedCount = stateService.currentCheckedCount();
      if (checkedCount === 0) {
          return  {
            'isNotChecked' : true
          };
        }
      return null;
    };
  }

```

The test function:

```
import { myValidation } from '@app/shared/validators/modification.validator';

const mockStateService = jasmine.createSpyObj('StateService',
    [ 'getCategoryState',
      'getCheckedCount'
    ]);

  it('should add validation to my form group when value is Yes', () => {

    const vehicleModificationsFormGroup = component.form.controls['vehicleModifications'];

    component.form.get('button').setValue('Yes');
    component.onSelected();

    myFormGroup.validator = myValidation.requireCheckboxesToBeChecked(mockStateService);
    expect(mockStateService.currentCheckedCount).toEqual(0);
    expect(myFormGroup.validator.length).toBe(1);
  });

```

I'm getting "stateService.currentCheckedCount is not a function" which is in the validator file