A Tale of Non-DI
Mock Anything, Anywhere
let component: HelloComponent; let userService: UserService; beforeEach(() => { TestBed.configureTestingModule({ declarations: [ HelloComponent ], providers: [ {provide: UserService, useClass: MockUser} ] }); component = TestBed.createComponent(HelloComponent).componentInstance; // use HelloComponent with MockUser in place of UserService });