1
votes

There are plenty of questions are existed regarding to this error and I have verified almost all but not getting resolved with those answers and suggestions. So please apologize for this.

I have tried to test an angular component by using Jasmine and Karma. Initially through 'ng test' I got an error like "Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/SearchActionsComponent.ngfactory.js'. thrown"

Afetr through 'ng test --source-map=false' I got error like this "Uncaught TypeError: Cannot read property 'length' of undefined". Error coming after fixture.detectChanges() as per my observation but I am not sure that exact reason. So could any one please help me.

1
you should not test real time service calls in karmaAravind
@Aravind I have removed all test cases now i am checking basic one, it('should create', () => { expect(component).toBeTruthy(); }); Still getting that same error.user10083387

1 Answers

2
votes

Here there is no problem with your either test case file and class file as well it seems, better to check once in template class. If any where you are handling undefined thing with respective length.