Angular.js promise not resolving when unit testing service with karma
问题 I am trying to unit test an Angular.js service, and need to set an expect on a promise returned from a Mock service (using Jasmine). I am using the karma unit testing framework. The relevant code snippet is below: // I can't figure out how to do the equivalent of a $scope.$digest here. var loginStatusPromise = FacebookService.getFacebookToken(); loginStatusPromise.then(function(token) { expect(false).toBeTruthy(); // If this test passes, there is something going wrong! expect(token).not