You need to add your second component when creating your testing module as that module is part of component 1. If you don’t the module won’t have my-component2 and the input will be invalid.
TestBed.configureTestingModule({
declarations: [ MyComponent1Component, MyComponent2Component ],
imports: [],
providers: [MyService1Service, HttpClient, HttpHandler, HttpTestingController]
})