I'm trying to test that a button click triggers a service method call.
The component content (a bit cleaned) looks like this

```
ngOnInit() {
    try {
      //GET ALL ITEMS
      this.service.getAll().pipe(untilDestroyed(this)).subscribe((result) => {
        this.list = result;
      });
    }
    catch (ex) {
      this._utility.showNotification(ex, 2);
    }
  }

refresh() {
  this.ngOnInit();
}

```

and the spec file looks like this:

```
it('REFRESH Button should call ngOnInit and getAll', () => {
    var spy = spyOn(component, "ngOnInit");
    var spyGet = spyOn(component.service, 'getAll').and.returnValue(of([]))
    let btnRefresh = fixture.debugElement.query(By.css('.btn-info')).nativeElement
    btnRefresh.click()

    fixture.whenStable().then(() => {
      fixture.detectChanges()
      expect(spy).toHaveBeenCalled();
      expect(spyGet).toHaveBeenCalled();
    })
  });

```

The current error what I get is the following:

> 
> Expected spy getAll to have been called.
> 
> 
>