title: NGRX Effects testing with { dispatch: false }
body: <p>I have been trying to get this working for hours. This is the first project I have converted over to Jest instead of Karma and so far so good. I went to write some tests for my effects though and for whatever reason, I am completely unable to test them in the way I would expect.</p>
  
  <p>The effect I am trying to test is a pretty simple navigate one:</p>
  
  <pre><code>@Effect({ dispatch: false })
  go$ = this.actions$.pipe(
    ofType(RouterActions.GO),
    tap(
      ({ payload: { path, query: queryParams, extras } }: RouterActions.Go) =&gt; {
        this.router.navigate(path, { queryParams, ...extras });
      }
    )
  );
  </code></pre>
  
  <p>I have injected a fake router and was going to test that it was calling navigate, that test has gone through many iterations trying to get it to work but the one I currently have is:</p>
  
  <pre><code>describe('Router Effects', () =&gt; {
    let actions$: Observable&lt;any&gt;;
    let router: TestRouter;
    let effects: RouterEffects;
    beforeEach(() =&gt; {
      TestBed.configureTestingModule({
        providers: [
          RouterEffects,
          provideMockActions(() =&gt; actions$),
          {
            provide: Router,
            useFactory: getRouter
          }
        ]
      });
  
      actions$ = TestBed.get(Actions);
      router = TestBed.get(Router);
      effects = TestBed.get(RouterEffects);
    });
  
    describe('go$', () =&gt; {
      test('should call router.navigate with the correct path', done =&gt; {
        const action = new fromActions.Go({ path: ['some', 'path'] });
  
        actions$ = hot('-a', { a: action });
        const expected = cold('-b', { b: action });
  
        effects.go$.subscribe(
          result =&gt; {
            console.log('inside subscribe?');
            expect(router.navigate).toHaveBeenCalled();
            console.log('after expect');
            done();
            console.log('after done?');
          },
          done,
          done
        );
  
        expect(effects.go$).toBeObservable(expected);
      });
    });
  });
  </code></pre>
  
  <p>When I run that test, I get the following results in my terminal:</p>
  
  <pre><code>FAIL  src/app/store/effects/router.effects.spec.ts (5.832s)
    ● Console
  
      console.log src/app/store/effects/router.effects.spec.ts:48
        inside subscribe?
      console.log src/app/store/effects/router.effects.spec.ts:50
        after expect
      console.log src/app/store/effects/router.effects.spec.ts:52
        after done?
  
    ● Router Effects › go$ › should call router.navigate with the correct path
  
      Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
  </code></pre>
  
  <p>I have been pulling my hair out trying to figure out why that async callback is not being called? I have reproduced a minimal repo here: <a href="https://github.com/BenAychh/example-ngrx-effects-jest" rel="nofollow noreferrer">https://github.com/BenAychh/example-ngrx-effects-jest</a> and the code in question is located in this folder <a href="https://github.com/BenAychh/example-ngrx-effects-jest/tree/master/src/app/store/effects" rel="nofollow noreferrer">https://github.com/BenAychh/example-ngrx-effects-jest/tree/master/src/app/store/effects</a>. If anyone is interested in helping me out here, you should be able to clone down that entire repo and just run it and (hopefully) see what I am seeing.</p>