Marble Tests

Learn how to test Observables the right way using Marble tests.

We'll cover the following...

In this lesson, you will be introduced to Marble Testing. One of the major drawbacks it overcomes is the ability to test asynchronous Observables synchronously using virtual time. The virtual time in RxJS is ‘provided’ via a Scheduler.

Schedulers

A scheduler is simply a data structure that can queue different asynchronous tasks and execute them based on criteria- either priority or a different execution algorithm. The most important aspect of it is the virtual “time”, provided by the method now(). Every task that is scheduled by a scheduler will be executed relative to the virtual clock. There are several types of schedulers that can help you achieve this: AsyncScheduler, QueueScheduler, AsapScheduler, etc. ...