0

I'm trying to unit test a service provided by an angular module I've created, however I'm struggling to find a way to do so without also invoking the module's run block when it is loaded in. Does anyone have any ideas?

Keir
  • 440
  • 6
  • 15

1 Answers1

1

"Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests." Angular docs.

But I guess you could use Jasmine's spy to SpyOn .run and return some fake function (e.g. angular.noop()).

Hope this helps :)