How to deal with promises in JavaScript unit tests?


One of my readers, Richard, sent me an email asking about promises in tests. It’s difficult to figure out how to put together a complete testing setup for code that uses promises, as there are so many different alternatives and so little information.

I wanted to help, so in this article, I’ll tell you exactly what to do when you need to use promises in unit tests:

  • How to integrate promises in unit tests
  • Which libraries can help?
  • 8 common promise-related testing scenarios
  • An example project showing how to put all of this together in practice

Head on over to the link to read more:

Promises in JavaScript Unit Tests: the Definitive Guide