...

/

Naive Testing Approach

Naive Testing Approach

Start testing Observable streams using the naive testing approach.

We'll cover the following...

So far, you have learned that Observables are lazy; they start emitting values only when an Observer is subscribed to it. So, how do you test a lazy Observable? The answer is simple: you simply subscribe to the Observable and expect the right values. Let’s analyze the following code:

var observable$ = getObservableForTest()
it('Testing a lazy observable', () => {
  
   observable$.subscribe(callbackFunction)

})

First of all, this is a simple unit test using Mocha.js; I will not go ...