title: test an http call inside a promise with jasmine
body: <p>I am learning angular and unit testing and can't seem to get past this issue. Perhaps I am doing it all wrong but i want to test that an http call was made.</p>
  
  <p>app.service.ts:</p>
  
  <pre><code>transformData(data):Promise&lt;any&gt;{
      return new Promise((resolve, reject) =&gt; {
            this.http.post&lt;any&gt;('https://www.example.com',data).subscribe(
          resp =&gt; {
           resolve(resp);
           },
          err =&gt; {
           reject(err);
           }
        );
  
         });
      }
  </code></pre>
  
  <p>my test is now:</p>
  
  <pre><code>fit("should submit data for processing", fakeAsync(() =&gt; {
  
      const service = TestBed.get(AppService);
  
      let response = {
        processedData: 100
      };
  
      service
      .transformData({'data':'data'})
      .then(result =&gt; {
        expect(result).toEqual(response);
      });
  
     // Expect a call to this URL
    const req = httpTestingController.expectOne(
    "https://www.example.com/"
      );
    expect(req.request.method).toEqual("POST");
    req.flush(response);
    tick();
  
    }));
  </code></pre>
  
  <p>It says:</p>
  
  <pre><code>Error: Expected one matching request for criteria "Match URL: https://www.example.com/", found none.
  </code></pre>