title: Observable<void> doesn't invoke the subscriber
body: <p>I'm struggling to get a unit test around an Observable to behave the way I expect. I'm using an Observable essentially just to notify that a process has completed. There's no async code in the loggout function yet, but there will be when I implement all the logic. I don't need the observable to return any data, I just want it to invoke the subscriber as a signal that the logout is complete.</p>
  
  <p>The problem is my Unit Tests revealed the subscriber is never actually invoked. I normally work with async/await, ironically because Observables tend to give me headaches by doing stuff like this, but I'm trying to get better at the front-end, which seems to prefer Observables.</p>
  
  <p>This is a new Angular 9 application that I'm scaffolding up. Unit tests are running in Jest, and I'm running them through Wallaby.</p>
  
  <p>Here's my troubleshooting:</p>
  
  <p>I deliberately broke the function to verify my my unit test works.</p>
  
  <p><a href="https://i.stack.imgur.com/0ZUV6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ZUV6.png" alt="Test doesn&#39;t invoke assertion"></a></p>
  
  <p>The grey box on line 63 of my tests is Wallaby indicating that the test never executed that line. So naturally the test passed because the assertion was never checked.</p>
  
  <p>If I change the observable to return a value I at least get the line to execute... sort of.</p>
  
  <p><a href="https://i.stack.imgur.com/QJI4M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QJI4M.png" alt="Assertion invoked, but incorrect error."></a></p>
  
  <p>But I'm not getting getting the expected failure message from my mock. It should report "expected clearSession() to be called 1 times, was 0"</p>
  
  <p>So I run Jest just to see what's going on and I get:</p>
  
  <pre><code>FAIL  src/app/auth/auth.service.spec.ts
  ● AuthService › logout › should destroy the session
  
  1 timer(s) still in the queue.
  
    at node_modules/zone.js/dist/fake-async-test.js:621:31
    at ZoneDelegate.Object.&lt;anonymous&gt;.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
    at ProxyZoneSpec.Object.&lt;anonymous&gt;.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
    at ZoneDelegate.Object.&lt;anonymous&gt;.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
    at Zone.Object.&lt;anonymous&gt;.Zone.run (node_modules/zone.js/dist/zone.js:143:47)
  </code></pre>
  
  <p>To make things really strange... if I fix the function everything is happy! But only so long as the Observable is returning a value, even though I'm only using the Observable to notify when the process is complete. But I haven't been able to get my actual assertion to fail, it failed because of something seemingly unrelated (The timer in queue? Whatever that means).</p>
  
  <p><a href="https://i.stack.imgur.com/jM2QM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jM2QM.png" alt="Test passes with assertion executed"></a></p>
  
  <p>The <code>verify</code> function is from <code>ts-mockito</code> and works essentially like the <code>expect(someSpy).toHaveBeenCalledTimes()</code> function.</p>
  
  <p>Is there some quirk about Observables that I'm missing?</p>