Advanced Asynchronous JavaScript

Advanced Asynchronous JavaScript Q&A: Testing Observables and Wrapping Up

Check out a free preview of the full Advanced Asynchronous JavaScript course:
The "Q&A: Testing Observables and Wrapping Up" Lesson is part of the full, Advanced Asynchronous JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

After answering a question about debugging and testing observables, Jafar concludes the course.

Get Unlimited Access Now

Transcript from the "Q&A: Testing Observables and Wrapping Up" Lesson

>> You talked about debugging observables, but what about writing code to test them?
>> Testing them, yeah. Well, so I don't think testing an observable is really any harder than any other asynchronous testing. Honestly, I think it's a little easier, because observable outputs values, it's not just some callback that does some stuff.

[00:00:18] So you can always test observables, actually, if you wanna test observables take a look at the RxJs unit test code. Because in fact, it actually uses strings, this convention of dot-dot-dot, it actually uses dash-dash-dash. But it actually creates a bunch of strings, to represent observables, and then a string to represent their output.

[00:00:38] And that's how they unit test their observables. So you can steal the same idea. I think it's exceptionally easy to unit test and you got a framework like that, but great question. All right, thanks a lot. This has been great.