AngularJS : Testing factory that returns $http promises
Trying to test an angular service that returns an $http GET request and the then handler, but I'm not able to test that the logic actually works inside of the then function. Here is a basic, truncated version of the service code: angular.module('app').factory('User', function ($http) { var User = {}; User.get = function(id) { return $http.get('/api/users/' + id).then(function (response) { var user = response.data; user.customProperty = true; return user; }); }; return User; }); And here is the test: beforeEach(module('app')); beforeEach(inject(function(_User_, _$q_, _$httpBackend_, _$rootScope