Test Asynchronous Code
Learn when to use async/await syntax to test asynchronous code.
Asynchronous code runs as a callback function, for example, after a timeout or interval. The best way to run asynchronous code in modern JavaScript is using the async
/await
notation. Jasmine makes this easy to test. Look at the example below, where we await
the result of the loadPosts
method before making our expectations.
Access this course and 1400+ top-rated courses and projects.