Error: Unexpected value 'DecoratorFactory' imported by the module 'DynamicTestModule'
I'm getting error during creating Test component instance.
`let comp: TaskviewComponent;
let fixture: ComponentFixture
describe('TaskviewComponent', () => {
beforeEach( () => { TestBed.configureTestingModule({ declarations: [ TaskviewComponent ], imports: [ NgModule, RouterTestingModule, TranslateModule.forRoot(), ], providers: [ DomainCacheService, RestDataService, Restangular, {provide: OAuthService, useClass: OAuthServicMock}, {provide: ComponentFixtureAutoDetect, useValue: true}, {provide: UserInfoService, useClass: UserInfoServiceMock}, { provide: LocalStorageService, //provide: LOCAL_STORAGE_SERVICE_CONFIG, useValue: { prefix: ApplicationConstants.ANGULAR2_LOCAL_STORAGE_ID, storageType: 'sessionStorage' } }],, }) fixture = TestBed.createComponent(TaskviewComponent); comp = fixture.componentInstance; deTaskTitle = fixture.debugElement.query((By.css('.Subject'))); elSub = deTaskTitle.nativeElement;
});
it('should have a subject', () => {
expect(elSub.textContent).toContain('Client Data Maintenance2 '); }); }); `
I'm getting Error: Unexpected value 'DecoratorFactory' imported by the module 'DynamicTestModule' error. I notice that if I remove "fixture = TestBed.createComponent(TaskviewComponent);" error would be resolved.
You can't import 'NgModule' as it is a decorator not a module.
Questions goes to SO.