I\'m struggling to work out the best way to verify that a promise is rejected in a Mocha test while using async/await.
Here\'s an example that works, but I dislike t
This example only works with Node!
When you use Mocha on Node.js you can use doesNotReject() or rejects() both require a function that returns a promise.
Example for when it should reject:
await rejects(testFunction());
see: https://nodejs.org/api/assert.html#assert_assert_rejects_asyncfn_error_message
Example for when it should not reject:
await doesNotReject(testFunction());
see: https://nodejs.org/api/assert.html#assert_assert_doesnotreject_asyncfn_error_message