jeudi 16 avril 2015

Testing if Angular asynchronous function returns a promise fails in Jasmine

I am trying to test if an asynchronous call returns a promise and it is failing. The function I am testing:



findOne: (collection, query) ->
@find collection, query


where find is function that simply makes a call to $http.post


The spec that is failing: describe "#findOne", () ->



it "should return a promise", () ->
expect(entitySvc.findOne.then).toBeDefined()


Why is this failing? find is simply returning the httpPromise object returned by $http.post.


Aucun commentaire:

Enregistrer un commentaire