Test Promises Using Async and Await

In everyday work, we often need to deal with Promises (MDN article). Jasmine allows for a straightforward way of testing these using async and await (MDN article)

The ArticleDelete class

What follows is a very simplified example of a class that handles deleting articles in a browser application. It accepts some input and makes a request to a server API if conditions are met.

For this lesson, the ArticleAPI methods are considered returning instances of Promise. So, the delete method returns a Promise.

Run the code playground below and see the breakdown below.

Get hands-on with 1400+ tech skills courses.