I thought I was using the AngularJS $q interface correctly. But the function I'm passing to the then callback is never being executed. And I am calling resolve in the function which is wrapped by $q. I've verified that resolve() is being called, yet it seems this is not the same function which is chained with .then():
$q(function(resolve, reject) {
resolve();
reject();
console.log("This happens"); //This shows that resolve() is being called
}).then(function() {
console.log("This doesn't"); //Yet this never gets executed
}).catch(function() {
console.log("This also doesn't happen");
});
The output is:
This happens
What am I doing wrong?
My environment is a KarmaJS unit test with mocha and sinon-chai.
Aucun commentaire:
Enregistrer un commentaire