DEV Community

Discussion on: TDD in Angular - Dependency Injection and Mocking

Collapse
bodote profile image
bodote

I think MockInventoryService is not necessary here. You can make a spy without it.
Your tests would do just fine, if you use the real service, but using the spyOn()'s .and.returnValue() method, or any other of spyOn()'s methods, to make the spy do what you need for your test.
That would save you a lot of lines of code.