vendredi 27 novembre 2015

How to test a factory which uses $injector in angularjs/karma?

I'm currently trying to test a PubSub service for my angularjs app which will be a buffer between several services.

For example: My Factory A calls $injector to inject my Pubsub service for subscribe/publish without having circular dependencies declarations. And the PubSub calls Service B.

This example works fine. But I'm struggling with the unit tests. Because of this : "Error: Injector already created, can not register a module!" I don't know how to succeed my tests. Any help would be Great, thx.

Aucun commentaire:

Enregistrer un commentaire