can someone help me in testing the below code. My function goes as follows
function BiAlertsService(DS,companyUrlConfig) {
return DS.defineResource({
name: 'bi-alerts',
idAttribute: 'id',
endpoint: companyUrlConfig.companyApi + companyUrlConfig.companyBaseUrl+ companyUrlConfig.resources.alerts + '/' + '{companyId}/{empId}' + companyUrlConfig.resources.biAlerts,
deserialize: function(resourceConfig, data) {
var json = data.data;
return {
id : JSON.stringify(json),
data : json.data
};
}
});
}
I could able to initialize the service , bur unable to test deserialize function I tried to create a spy for it, but some how unable to test it Below is my Spec code
beforeEach(inject(function (biAlerts,_DS_, $q,$rootScope,_companyUrlConfig_) {
biAlerts = biAlerts;
$scope = $rootScope.$new();
companyUrlConfig=_companyUrlConfig_;
DS=_DS_;
deferred=$q.defer();
}));
DS.defineResource = jasmine.createSpy('').and.returnValue(deferred.promise);
Thanks in advance