NestJS · Junior · Question 25 of 75

What is the main benefit of dependency injection?

Explanation

In tests you can override a provider with a fake implementation without changing the class under test.

Further reading

Problem with a question

NestJS · Junior · question 25

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz