Hi Team,
Developing on ADF 2.4.0, I am using Karma(v2.0.4) Jasmine(2.6.4) to perform unit testing of the custom components by executing command 'ng test -sourcemap=false'.
I am getting error -- TypeError: Cannot read property 'getEcmUsername' of undefined
**Please find attached a screenshot of the error.
Below is the .spec.ts file
Please note that earlier, I was using karma(v1.7.0) and later upgraded to v2.0.2 but not luck. I get the same error.
Please help me with the solution here.
We have hundreds of working unit tests that are also open. Please refer to the existing tests to see how corresponding services used.
Hi Denys,
Any help to documentation links of existing tests would be really appreciated. Thanks!
Hi,
I also tested a service that I created using Angular CLI. The service imports many ADF services that are used in it.
When i unit tested it by executing command 'ng test -sm=false' , I got couple of StaticInjectorError - No Provider...
So, I included all those services in the provider section of spec.ts file. Services included are:
After all this, now I get following error
TypeError: this.customLoader.init is not a function at TranslationService.use (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/@alfresco/adf-core/esm5/adf-core.js?:2100:27) at SafeSubscriber.eval [as _next] (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/@alfresco/adf-core/esm5/adf-core.js?:2067:19) at SafeSubscriber.__tryOrSetError (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Subscriber.js?:253:16) at SafeSubscriber.next (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Subscriber.js?:193:27) at Subscriber._next (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Subscriber.js?:132:26) at Subscriber.next (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Subscriber.js?:96:18) at BehaviorSubject._subscribe (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/BehaviorSubject.js?:33:24) at BehaviorSubject.Observable._trySubscribe (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Observable.js?:177:25) at BehaviorSubject.Subject._trySubscribe (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Subject.js?:107:51) at BehaviorSubject.Observable.subscribe (webpack:///C:/MSDE/anshkuma/msim-cms-new/src/node_modules/rxjs/_esm5/Observable.js?:165:65)
I'd appreciate if you could let me know exactly how we can solve this testing issue.
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.