lundi 4 mai 2015

How do mock asynchronous methods that are called multiple times with different parameters in Jasmine/AngularJS?

I have testing a controller method that loops over an asynchronous method. If the method was only called once, I would create a spy and return the pertinent data. However, the async method needs to be called multiple times. For my test, I want to loop over the method twice and resolve the promise with different data for each iteration.

# coffeescript
for i in set
  mySvc.myAsyncMethod id
  .then (results) ->
     # do stuff

Aucun commentaire:

Enregistrer un commentaire