title: How cant test Query, Mutation, Subscription services using Apollo Angular?
body: <p>I saw the examples of how <a href="https://www.apollographql.com/docs/angular/guides/testing/#apollotestingmodule" rel="nofollow noreferrer">testing apollo in angular</a> works and basically only use the <a href="https://www.apollographql.com/docs/angular/guides/testing/#apollotestingmodule" rel="nofollow noreferrer">ApolloTestingModule</a> to make the tests. And my test looks like: </p>
  
  <h1>Test suit</h1>
  
  <pre class="lang-js prettyprint-override"><code>
  describe('CountriesService', () =&gt; {
    let countryService: CountriesService;
    let controller: ApolloTestingController;
    let scheduler: TestScheduler;
    let countries: any;
  
    beforeAll(() =&gt; {
      TestBed.configureTestingModule({
        imports: [ApolloTestingModule],
      });
  
      countries = [{ code: 'C1', phone: '500', name: 'Country' }];
      scheduler = new TestScheduler((actual, expected) =&gt; {
        expect(actual).toEqual(expected);
      });
      countryService = TestBed.inject(CountriesService);
      controller = TestBed.inject(ApolloTestingController);
    });
  
    test('should be created', () =&gt; {
      expect(countryService).toBeTruthy();
    });
  
    test('should return an array of countries', () =&gt; {
      countryService.watch().valueChanges.subscribe(console.log);
  
      const operation = controller.expectOne(COUNTRIES_GQL);
      operation.flush({ data: { countries } });
  
      controller.verify();
    });
  });
  </code></pre>
  
  <h1>Service</h1>
  
  <pre class="lang-js prettyprint-override"><code>@Injectable({ providedIn: 'root' })
  export class CountriesService {
    constructor(private apollo: Apollo) {}
  
    watch() {
      return this.apollo.watchQuery({
        query: COUNTRIES_GQL,
      });
    }
  }
  </code></pre>
  
  <h1>Problem</h1>
  
  <p>I want to use the approach of using  <a href="https://www.apollographql.com/docs/angular/basics/services/" rel="nofollow noreferrer">Query, Mutation, Subscription service</a> but with this approach the test doesn't work.</p>
  
  <pre class="lang-js prettyprint-override"><code>@Injectable({ providedIn: 'root' })
  export class CountriesService extends Query&lt;any&gt; {
    document = COUNTRIES_GQL;
  }
  </code></pre>
  
  <h1>Error</h1>
  
  <pre class="lang-sh prettyprint-override"><code>● CountriesService › should return an array of countries
  
      TypeError: Cannot read property 'use' of undefined
  
        30 | 
        31 |   test('should return an array of countries', () =&gt; {
        32 |     countryService.watch().valueChanges.subscribe(console.log);
           |                    ^
        33 | 
        34 |     const operation = controller.expectOne(COUNTRIES_GQL);
        35 |     operation.flush({ data: { countries } });
  </code></pre>
  
  <p>For me the error makes sense because in the official implementation of <a href="https://github.com/kamilkisiela/apollo-angular/blob/master/packages/apollo-angular/src/Query.ts" rel="nofollow noreferrer">Query class</a> the methods fetch and watch are using the <strong>use method</strong> provided by Apollo service.</p>
  
  <h1>Questions</h1>
  
  <ul>
  <li>Does an alternative to test this type of service provided by apollo ?</li>
  <li>If I want to use this approach, I should test it as a basic service?</li>
  </ul>
  
  <p>I wait for your answers</p>