title: cannot read property 'pipe' of undefined - Angular 6
body: <p>Component.ts</p>
  
  <pre><code>// Component containing function
  Public myData(){
      this.myService.getData()
          .pipe(
              take(1),
              catchError((err: any) =&gt; {
                  this.myRows = [];
                  return throwError(err);
              }),
              finalize(() =&gt; {
                  console.log('In Finally');
              })
          )
          .subscribe((rows) =&gt; {
              this.myRows = rows;
              // Do something
          });
  }
  </code></pre>
  
  <p>myService.ts</p>
  
  <pre><code>// Service Call
  public getData(): Observable &lt; customer[] &gt; {
      const url = 'some url';
      return this.http.get(url).pipe(
          map(this.checkForError),
          catchError((err: HttpErrorResponse) =&gt; {
              return throwError(err);
          }),
          map(this.myJson),
          share()
      );
  }
  </code></pre>
  
  <p>spec.ts</p>
  
  <pre><code>    // Test Case
      it('should test', () =&gt; {
          let test =  spyOn(myService, 'getData');
          component.myData();
          expect(test).toHaveBeenCalled();
      });
  </code></pre>
  
  <p>Couldn't resolve this error. Not able to find an easy way of writing test case for service call. How can we resolve the pipe error ?</p>