title: Test a RxJS map function inside HTTP request
body: <p>I am testing an Angular service that includes a private mapper method as you can see below, my goal is to mock the method inside the RxJS map because it seems not to be tested for the coverage.</p>
  <p><a href="https://i.stack.imgur.com/T0jvp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T0jvp.png" alt="enter image description here" /></a></p>
  <p>This is my Jest test but the method seems not tested, maybe I need to mock the private method?</p>
  <pre><code> test('should test the download file', () =&gt; {
      const fakeurl = 'http://fakeurl';
      service.downloadFile(fakeurl).subscribe((resp: IDownload) =&gt; {
        expect(resp).toBe(mockDownloadedFile);
      });
  
      const req = httpMock.expectOne(request =&gt; request.url.includes(fakeurl), 'call api');
      expect(req.request.method).toBe('GET');
      req.flush(new Blob());
    });
  </code></pre>