Testing Angular 2 service that returns a Promise
<p>I'm trying to unit test a service which should use fake http backend, provided by Angular's in-memory data service. This is the relevant code:</p>

<pre><code>describe('getCars() method ', ()  =&gt; {
      it('should return a resolved Promise', inject([DataService], (service: DataService) =&gt; {
        service.getCars().then((value) =&gt; {
          expect(value.length).toBe(3);
       });
    }));
  });
</code></pre>

<p>The problem is I can't use Jasmine's <em>done</em> callback to treat the asynchronous <strong>service.getCars()</strong> call, because of how inject function works. I can't use <em>async</em> test helper neither, because it can't work with promises. So I have no idea how to wait for promise to resolve---the test just runs without ever reaching <em>expect</em>.</p>