">it(&#39;should simulate promise&#39;, inject(function($q, $rootScope) {
  var deferred = $q.defer();
  var promise = deferred.promise;
  var resolvedValue;

  promise.then(function(value) { resolvedValue = value; });
  expect(resolvedValue).toBeUndefined();

  // Simulate resolving of promise
  deferred.resolve(123);
  // Note that the &#39;then&#39; function does not get called synchronously.
  // This is because we want the promise API to always be async, whether or not
  // it got called synchronously 