I'd like to test the values returned by an async operation using mocha. The values are provided via a plain A+ promise. Unfortunately the .then
handler will now swallow all the exceptions thrown by assert
so the tests will pass no matter what:
someOp().then(function(result){
// throws, but will be swallowed
assert(result.indexOf('I_DONT_WANT_THAT') < 0);
done();
});
How can I correctly test the result of my async operation? All I can think of is endlessly propagating the error, but at some point I will need assert to throw a real error for my test to fail.
Aucun commentaire:
Enregistrer un commentaire