I have a promise that needs to be resolved before I can call another method. This other method does not return a promise, but it does use a promise. I need to check that this final promise is resolved and the data is set correctly. To do this, I need to call root$scope.$digest(), but if I call it inside a promise, there is already a $rootScope.$digest() loop in progress outside the promise and I get an error. Code:
//spec file
var promise = doSomething();
promise.then(function(data) {
expect(data).toEqual(stub);
callSomeOtherMethod();//this method has a promise that needs to be resolved
$rootScope.$digest();//cannot do this
});
$rootScope.$digest();//if I remove this, promise is not resolved
Is there a way to get this to work?
Aucun commentaire:
Enregistrer un commentaire