DEV Community

Discussion on: Angular Environment Setup - Safe & Testable

Collapse
 
briancodes profile image
Brian • Edited

Using DI for testing is a really good idea! Haven't seen that before. Is useFactory necessary in the example - I would have thought that useValue would work for the same in the main app as in the tests?

Collapse
 
n_mehlhorn profile image
Nils Mehlhorn

Yeah, useValue should work as well, I'm just more used to useFactory in the actual module because I use that when providing window or localStorage.

Shouldn't make too much of a difference though with useFactory you could add some pre-processing later on.