How to Test Value Returned in Promise from AngularJS Controller with Jasmine?
I have a controller that expose a function that returns some text after a rest call. It works fine, but I'm having trouble testing it with Jasmine. The code inside the promise handler in the test never executes . The controller: /* global Q */ 'use strict'; angular.module('myModule', ['some.service']) .controller('MyCtrl', ['$scope', 'SomeSvc', function ($scope, SomeSvc) { $scope.getTheData = function (id) { var deferred = Q.defer(); var processedResult = ''; SomeSvc.getData(id) .then(function (result) { //process data processedResult = 'some stuff'; deferred.resolve(processedResult); }) .fail