resolving promise returned from a factory in jasmine #581

Closed
jitendrasbhati opened this Issue Apr 28, 2014 · 1 comment

Projects

None yet

3 participants

@jitendrasbhati

Hi,

I have designed a factory that contains a method that makes an asynchronous using $http.

I am trying to access promise values returned from factory in jasmine.

I want the returned promise value to be resolve in jasmine.

I need a simple example that would solve this issue

Please help me resolve the issue

The following is the piece of factory code

var app=angular.module('chartApp');

app.controller('chartCtrl', [
'$scope',
'$http',
'scatterplot',

    function($scope, $http, scatterplot) {

        $http({
    method: 'GET',
    url: 'RNASequenceDataServlet',
         headers: { 'Content-Type': 'application/json' },

  })
  .success(function (data, status, headers, config) {


        deferred.resolve(configu);

}
return (deferred.promise);

});
});

Please help me wrtitng a test case with proper syntax that will help me resolve this issue

@infews
Collaborator
infews commented Jun 23, 2014

Since this is a "how to test" type of question, have you tried the Jasmine Google Group - jasmine-js@googlegroups.com. More of the community gathers there to help people with testing patterns..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment