title: Angular8 service unit test
body: <p>In my project there is a sharedService in the share folder that is called into all the services.
  In fact, my services send their request to this sharedService and the sharedService send a http request according to the url that it received.
  How do I write a unitTest for my services?</p>
  
  <blockquote>
    <p>sharedService has Api method:</p>
  </blockquote>
  
  <pre><code>import { Injectable } from "@angular/core";
  import { Observable } from "rxjs";
  import { HttpClient } from '@angular/common/http';
  
  @Injectable({
    providedIn: "root"
  })
  
  export class SharedService {
  
    constructor(
      private httpClient: HttpClient) {
    }
  
  
    Api(method, url): Observable&lt;any&gt; {
      this.httpClient.request(method, url).subscribe( );
    }
  
  }
  </code></pre>
  
  <blockquote>
    <p>The usersService in the users module send its request to the Api
    method in sharedService:</p>
  </blockquote>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { SharedService } from 'app/shared/services/shared.service';
  
  @Injectable({
    providedIn: 'root'
  })
  export class usersService {
  
    constructor(private sharedService:SharedService) { }
  
    GetUsers() {
      return this.sharedService.Api('get' , 'url');
    }
  }
  </code></pre>
  
  <blockquote>
    <p>How do I write for usersService unitTest?</p>
  </blockquote>