DEV Community

Discussion on: Angular unit testing 101 (with examples)

Collapse
 
mustapha profile image
Mustapha Aouas

Hi,

When you import the appModule, you are importing all the exported properties of the appModule.

Do you have your testComponent in the exports array of the appModule ?

Collapse
 
likepeach789 profile image
peach777

Yes I export it.. TestComponent extend another class and that class is using Injector to get service without using constructor.. The error happens at: AppModule.Injector.get(TestService) this line, said Cannot read property 'get' of undefined.

I create a question of this on stackoverflow, stackoverflow.com/questions/588577...

Maybe you could help give some advice. Thanks tons. : )