Hi,
when I start *ng test* I get a exception from this test:
it('should create', () => {
expect(component).toBeTruthy();
});
here the exception:
Chrome 65.0.3325 (Windows 10.0.0) LanguageSelectorComponent should create
FAILED
TypeError: this.service.get is not a function
at new LanguageSelectorComponent
src/app/shared/language-selector/language-selector.component.ts:37:44)
at createClass node_modules/@angular/core/esm5/core.js:12441:1)
at createDirectiveInstance
node_modules/@angular/core/esm5/core.js:12284:22)
at createViewNodes
node_modules/@angular/core/esm5/core.js:13742:38)
at createRootView
node_modules/@angular/core/esm5/core.js:13631:1)
at callWithDebugContext
node_modules/@angular/core/esm5/core.js:15056:26)
at Object.debugCreateRootView [as createRootView]
node_modules/@angular/core/esm5/core.js:14339:1)
at
ComponentFactory_.webpackJsonp../node_modules/@angular/core/esm5/core.js.ComponentFactory_.create
node_modules/@angular/core/esm5/core.js:11236:26)
at initComponent
node_modules/@angular/core/esm5/testing.js:1150:1)
at
ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke
node_modules/zone.js/dist/zone.js:388:1)
Expected undefined to be truthy.
at UserContext.<anonymous>
src/app/shared/language-selector/language-selector.component.spec.ts:45:23)
at
ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke
node_modules/zone.js/dist/zone.js:388:1)
at
ProxyZoneSpec.webpackJsonp../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke
node_modules/zone.js/dist/zone-testing.js:239:1)
at
ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke
node_modules/zone.js/dist/zone.js:387:1)
Chrome 65.0.3325 (Windows 10.0.0): Executed 38 of 46 (1 FAILED) (0 secs / 0
secs)
This logging apears two times.
At the LenguageSelectorComponent I call
this.cookieLanguage = this.service.get('language');
this.servise i a costumized Service extends by CookiesStorageService,
CookiesStorageService extends WebStorageService.
WebStorageService is a abstract class and includes
get(key: string): any;
Why I get the exception at the unit test?
Would be great to get help.
Frank
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.