title: Not able to test if nested function is called in Jasmine
body: <p>I'm learning to write test cases in jasmine ,I was trying to create  a test case to check if the functions defined within the function are called</p>
  <p>My function that I'm trying to test is as follows,and the sData method is written in another component that is being extended by current component</p>
  <pre><code>public rPage() {
      this.sData();
      this.setupPage()
    }
  </code></pre>
  <p>the test case that i wrote is as below</p>
  <pre><code>   it('should check if  sData is called', () =&gt; {
      const sData = spyOn&lt;any&gt;(component, 'sData');
      component.rPage();
      fixture.detectChanges();
      expect(sData).toHaveBeenCalled();
    });
  </code></pre>
  <p>have created spy on rpage already in beforeeach as below</p>
  <pre><code> beforeEach(() =&gt; {
      fixture = TestBed.createComponent(BasicComponent);
      component = fixture.componentInstance;
      spyOn(component, 'rPage');
      fixture.detectChanges();
    });
  </code></pre>
  <p>still when i run the test ,the test case fails saying &quot;Expected spy sData to have been called.&quot; ,where I'm going wrong</p>