title: Angular Jasmine this service method is a not a function
body: <p>I am trying to get a service method to pass inside a unit test, however it keeps failing:</p>
  <p>&quot;TypeError: this.eventsService.getEvent is not a function&quot;</p>
  <p>My code inside my component:</p>
  <pre><code>constructor(
   private eventsService: EventsService
  )
  
  this.subscriptions.add(
    this.eventsService.getEvent().subscribe(events =&gt; {
      this.events = events;
      this.soSomeMethod();
    })
  );
  // Also have a V2 method, unsure if it matters but adding it for clarity
  this.subscriptions.add(
    this.eventsService.getEventV2().subscribe(eventsV2 =&gt; {
      this.eventsV2 = eventsV2;
      this.soSomeMethod();
    })
  );
  </code></pre>
  <p>This is the service in question:</p>
  <pre><code>  public getEvent(): Observable&lt;event[]&gt; {
      return combineLatest(this.store.select(getEventStore), this.store.select(getEvents)).pipe(
        map(state =&gt; {
          // do something 
        })
      );
    }
    public getEventV2(): Observable&lt;event[]&gt; {
      return combineLatest(this.store.select(getEventStore), this.store.select(getEvents)).pipe(
        map(state =&gt; {
          // do something 
        })
      );
    }
  </code></pre>
  <p>My testing has the methods inside the providers:</p>
  <pre><code>    { provide: EventsService, useValue: { getEvent: () =&gt; of([])}},
      { provide: EventsService, useValue: { getEventV2: () =&gt; of([])}},
  </code></pre>