Maybe your best bet is simply to customize the layout to fit the needs of different test cases. Save it as an instance and use useValue instead of useClass
let urlLoderSvc: URLLoaderSvc; beforeEach(() => { urlLoaderSvc = new URLLoaderSvc(); TestBed.configureTestingModule({ providers: [ DocumentsLoaderSvc, { provide: MgrSvc, useClass: MockMgrSvc }, { provide: URLLoaderSvc, useValue: urlLoaderSvc } ] }); });
Now in test cases of it you can simply configure an instance of urlLoaderSvc to do whatever you want.
source share