title: How to avoid "ERROR: Spec method has no expectations" even when success?
body: <p>I have Angular HTTP service that makes some HTTP-calls.
  Here's an example of my service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  
  @Injectable()
  export class APIService {
      constructor(private readonly http: HttpClient) {}
  
      public async getUsers&lt;T&gt;(): Promise&lt;T[]&gt; {
          return await this.http.get&lt;T[]&gt;('/api/users').toPromise();
      }
  }
  </code></pre>
  
  <p>And here's my <code>spec.ts</code> file for <code>APIService</code>:</p>
  
  <pre><code>import { TestBed } from '@angular/core/testing';
  import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
  import { APIService } from './api.service';
  
  describe('API Service', () =&gt; {
      let service: APIService;
      let controller: HttpTestingController;
  
      beforeEach(() =&gt; {
          TestBed.configureTestingModule({
              imports: [HttpClientTestingModule],
              providers: [APIService]
          });
  
          service = TetsBed.get(APIService);
          controller = TestBed.get(HttpTestingController);
      });
  
      it('should create the API service', () =&gt; {
          expect(service).toBeTruthy();
      });
  
      it('should get users', () =&gt; {
          const expected = [{id: 1, email: 'email1@domain.tld'},
                            {id: 2, email: 'email2@domain.tld'}];
  
          service.getUsers&lt;MyUserClass&gt;().then((res) =&gt; {
              expect(res).toEqual(expected);
              controller.verify();
          });
  
          controller.expectOne('/api/users').flush(expected);
      });
  
  });
  </code></pre>
  
  <p>Everything seems to works, cause when I run <code>ng test</code>, I have message like this:</p>
  
  <pre><code>ERROR: 'Spec 'API Service should get users' has no expectations.'
  HeadlessChrome 77.0.3865 (Windows 10.0.0): Executed 13 of 15 SUCCESS (0 secs / 0.256 secs)
  HeadlessChrome 77.0.3865 (Windows 10.0.0): Executed 15 of 15 SUCCESS (0.42 secs / 0.28 secs)
  TOTAL: 15 SUCCESS
  TOTAL: 15 SUCCESS
  TOTAL: 15 SUCCESS
  </code></pre>
  
  <p>When I change something under next code, I got error.</p>
  
  <pre><code>.then((res) =&gt; {
      // expect(res).toEqual(expected);
      expect(res).toBeNull();
      controller.verify();
  });
  </code></pre>
  
  <p>So code above is fine and working.</p>
  
  <p>Then, why I have an error message with <strong>ERROR: 'Spec 'API Service should get users' has no expectations.'</strong>? Any ideas?</p>
  
  <p>I guess, async/await might cause this problem, cause I don't actually wait for it, however, it executes with no error, and when I put wrong data, then it fails.</p>
  
  <p>I also tried to wrap everything into <code>async</code>/<code>fakeAsync</code> methods - no luck.</p>