I guess I miss something. Have spent some time trying to understand why my test is not working.
The code.
angular.module('services')
.factory('UserPreferencesService', ['$resource', function ($resource)
{
return $resource('/rest/user-preferences/:id', {},
{ getById: { method: "GET", params: { id:'@id'}} });
}
]);
The test:
it('should get by Id', function() {
//given
var preferences = {language: "en"};
httpBackend.whenGET('/rest/user-preferences/1').respond(preferences);
//when
service.getById( {id:1} ).$promise.then(function(result) {
console.log("successssssssssssssssssssssssssssssssssssss");
//then
expect(result).toEqual(preferences);
}, function() {
console.log("something wrong");
})
});
It never triggers: "successssssssssssssssssssssssssssssssssssss".
What did I miss?