title: Angular testing service with akita query - mock data
body: <p>Im working with Akita state manager for angular.
  I have some service / class which is subscribing to one of my queries.
  Im trying to mock some data into my query with jasmine createSpyObj.</p>
  <p>This is my service (part):</p>
  <pre><code>export class SomeService implements OnDestroy {
    private activeElements$ = this.someAkitaQuery.selectActive();
  
    constructor(
          private someAkitaQuery: SomeAkitaQuery,
      ) {
          this.activeElements$.subscribe(activeElement =&gt; {
        ...
      });
      }
  }
  </code></pre>
  <p>This is my test:</p>
  <pre><code>import { TestBed, async, tick } from '@angular/core/testing';
  import { SomeLogicService } from './somelogic.service';
  import { SomeQueryService } from './some.service';
  import { SomeQuery } from '../stores/order/some/some.query';
  import { of } from 'rxjs';
  
  
  describe('EnhancementPriceService', () =&gt; {
      let logicService: SomeLogicService;
      let someQuery: jasmine.SpyObj&lt;SomeQuery&gt;;
  
      beforeEach(async(() =&gt; {
          TestBed.configureTestingModule({
              providers: [
                  {
                      provide: SomeQueryService,
                      useValue: jasmine.createSpyObj('SomeQueryService', ['get'])
                  },
                  {
                      provide: SomeQuery,
                      useValue: jasmine.createSpyObj('SomeQuery', ['selectActive'])
                  }
              ]
          });
      }));
  
      beforeEach(() =&gt; {
          someQuery = TestBed.get(SomeQuery);
          logicService = TestBed.get(SomeLogicService);
      });
  
      it('should return something', () =&gt; {
          SomeQuery.selectActive.and.returnValue(
              of([])
          );
          tick();
          logicService.someMethod();
      });
  });
  </code></pre>
  <p>Somehow I have test error which saying:</p>
  <p>&quot;Cannot read property 'subscribe' of undefined&quot;</p>
  <p>I based my test on oficial akita docs: <a href="https://datorama.github.io/akita/docs/angular/tests" rel="nofollow noreferrer">https://datorama.github.io/akita/docs/angular/tests</a>
  Guess problem is: Im trying to test Service, not component.
  Also tried to provide stub query - it was working like this, but for each test i need other data...</p>