...

/

Test the Hidden Promise Using Done or Await

Test the Hidden Promise Using Done or Await

Understand how to test methods that do not expose the Promise, using either the Done function or async and await.

In everyday work, we often need to deal with Promises (MDN article). If the function we test is async (it returns a Promise), we can use async and await in our tests.

When the function is not returning a Promise and not using the async keyword but still relies on a Promise, we can’t use Jasmine’s asynchronous testing capabilities directly. There are two ...