jeudi 22 août 2019

You should import core module only in the root module in Angular?

I have the following code in core.module.ts,

    export class coreModule {
        constructor(@Optional() @SkipSelf() core:coreModule) {
            if (core)   {                     //  --> Coverage if not entering if condition

                 throw new error ('You should import core module only in root module')
            }

        }

    }

When I run my test cases,the coverage is not full due to this if condition and I dont have a core.module.spec.ts to add a test case.Can anyone please help me to make coverage 100%.Thanks.

Aucun commentaire:

Enregistrer un commentaire