E
E
Ekaterina2015-03-01 22:54:22
Angular
Ekaterina, 2015-03-01 22:54:22

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

1 answer(s)
D
DigitalSmile, 2015-03-02
@DigitalSmile

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 question

Ask a Question

731 491 924 answers to any question