title: How to test that an Observable does not emit in Angular Component which contains asynchronous logic
body: <p>Let's say I have an Angular Component which defines an Observable <code>myObs$</code> as one of its properties.</p>
  
  <p>In one test, given certain conditions, I want to test that <code>myObs$</code> does not notify. In the logic there are some delays involved, so the test must be asynchronous.</p>
  
  <p>I am using <strong>Jasmine</strong>.</p>
  
  <p>So far I have been able to craft this solution:</p>
  
  <pre><code>it('async test', done =&gt; {
      let dataEmitted;
      myObs$
      .pipe(
        tap(data =&gt; dataEmitted = data),
      )
      .subscribe();
      setTimeout(() =&gt; {
        if (dataEmitted) {
          done.fail('should not emit');
        } else {
          done();
        }
      }, 1000);
    });
  </code></pre>
  
  <p>But I am far from happy with it. I have to rely on <code>setTimeout</code> to perform the checks and call the <code>done</code> function.</p>
  
  <p>Any suggestions on how to perform such tests properly? Synchronous solutions do not work since there is intrinsic asynchronicity in the logic.</p>