I want test some service AService, which has some dependencies BService, which is depended on another service e.x. CService. We have chain like dependencies:
AService --> BService --> CService
AService constructor:
constructor(
private bService: BService
) {}
BService constructor:
constructor(
private cService: CService
) {}
If I want test AService in my test file I should write something like this:
beforeAll(() => {
injector = ReflectiveInjector.resolveAndCreate([
AService,
BService,
CService,
]);
service = injector.get(AService);
});
and if I have too many services, which are chained each other I'll get too much boilerplate.
Is there any way to doesn't inject all chained services in my AService testing file?