title: Testing Observables with jest
body: <p>How can I test Observables with Jest?</p>
  
  <p>I have an Observable that fires ~every second, and I want to test that the 1st event is correctly fired, before jest times out.</p>
  
  <pre><code>const myObservable = timer(0, 1000); // Example here
  
  it('should fire', () =&gt; {
    const event = myObservable.subscribe(data =&gt; {
      expect(data).toBe(0);
    });
  });
  </code></pre>
  
  <p>This test passes, but it also passes if I replace with <code>toBe('anything')</code>, so I guess I am doing something wrong.</p>
  
  <p>I tried using <code>expect.assertions(1)</code>, but it seems to be only working with Promises.</p>