I am using Angular CLI 1.0.0-beta.32.2 and writing unit test for an Angular 2 service that dynamically creates a component and inserts it into another component.
In my unit test, I am trying to create a mock component to test my service, but the output of ng test throws an error stating that my mock Component is specified in the entryComponents property. When I try to add a component to the entryComponents property of the entryComponents object, like this: TestBed.createTestingModule({...entryComponents: [ TestDialogComponent ]...}) I see that the following error indicating the entryComponents property entryComponents not exist.
Chrome 56.0.2924 (Windows 10 0.0.0) DialogService should create a child component when opening FAILED Error: No component factory found for TestDialogComponent. Did you add it to @NgModule.entryComponents?
Looking at the definition of TestModuleMetadata shows that the entryComponents property does not exist. So, how do I dynamically create a component in my unit tests in Angular 2 and Jasmine?
source share