title: Jasmine function Spy doesn't work with angular
body: <p>I have an angular-cli project with the following test suite:</p>
  
  <pre><code>let fakeCellService = {
    getCellOEE: function (value): Observable&lt;Array&lt;IOee&gt;&gt; {
      return Observable.of([{ time: moment(), val: 67 }, { time: moment(), val: 78 }]);
    }
  };
  
  describe('Oee24Component', () =&gt; {
    let component: any;
    let fixture: ComponentFixture&lt;Oee24Component&gt;;
  
    beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        declarations: [Oee24Component],
        providers: [{ provide: CellService, useValue: fakeCellService }]
      })
        .compileComponents();
    }));
  
    beforeEach(() =&gt; {
      fixture = TestBed.createComponent(Oee24Component);
      component = fixture.componentInstance;
      fixture.detectChanges();
      spyOn(fakeCellService, 'getCellOEE');
    });
  
    it('should get cell oee on init', () =&gt; {
      component.ngOnInit();
      expect(fakeCellService.getCellOEE).toHaveBeenCalled();
    });
  });
  </code></pre>
  
  <p>However, the Spy in the test fails. I know the function is called, as I tested this in a debugger. I can't see how this differs from the documented examples, but presumably it does! Any ideas why?</p>
  
  <p>Here is my component:</p>
  
  <pre><code>@Component({
    selector: 'app-oee',
    templateUrl: './oee.component.html',
    styleUrls: ['./oee.component.css']
  })
  export class Oee24Component implements OnInit {
  
    constructor(public dataService: CellService) { }
  
    ngOnInit() {
      this.dataService.getCellOEE(this.cell).subscribe(value =&gt; this.updateChart(value));
    }
  
    updateChart(data: Array&lt;IOee&gt;) {
        //Logic here
    }
  }
  </code></pre>