Answer the question
In order to leave comments, you need to log in
How to test Angular module service without running run and config?
If a module has a run function (with dependencies), then to test one service of this module, you have to either load all the dependencies of this module or replace them.
How to avoid it?
Answer the question
In order to leave comments, you need to log in
I think you have a slightly incorrect view of testing. Your options "either load or replace" is the answer to your question.
If in your test the service is an auxiliary object and it is already covered by tests, then mock objects (substitution) are used. Otherwise, if the service is the key point of the module, then it must be loaded "as is" and its methods should be checked as well.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question