Hey, Thanks for replying. I don’t think I’ve got other dependencies. When I went to debugging I noticed that my test didn’t seem to use the mocked create function. Promise.resolve() was never called.
This is the code I’m using for my loader:
async presentLoader(duration?: number) {
this.loading = await this.loadingController.create({
spinner: 'crescent',
message: this.translate.instant('generic.feedback.loading'),
duration: duration,
cssClass: 'custom-loader',
});
return await this.loading.present();
}
dismissLoader() {
this.loading.dismiss().then();
}
And I’ve mocked the LoadingController in the service.spec.ts where the above code is located. I’m getting the error from Karma in a different spec file though. The strange thing is, I’m only getting the error on my ‘JobsPage’ even though I’ve imported the service with the LoadingController in all my pages.
Karma error:
Uncaught Error: Uncaught (in promise): TypeError: controller.componentOnReady is not a function
TypeError: controller.componentOnReady is not a function
at proxyMethod (http://localhost:9876/node_modules/@ionic/angular/dist/fesm5.js?:4339:1)
at LoadingController.push../node_modules/@ionic/angular/dist/fesm5.js.OverlayBaseController.create (http://localhost:9876/node_modules/@ionic/angular/dist/fesm5.js?:4384:1)
at SharedService.<anonymous> (http://localhost:9876/src/app/services/shared.service.ts?:64:49)
at step (http://localhost:9876/_karma_webpack_/main.js:2872:23)
at Object.next (http://localhost:9876/_karma_webpack_/main.js:2853:53)
at http://localhost:9876/_karma_webpack_/main.js:2847:71
at new ZoneAwarePromise (http://localhost:9876/node_modules/zone.js/dist/zone.js?:910:1)
at ./src/app/services/shared.service.ts.__awaiter (http://localhost:9876/_karma_webpack_/main.js:2843:12)
at SharedService../src/app/services/shared.service.ts.SharedService.presentLoader (http://localhost:9876/_karma_webpack_/main.js:2953:16)
at FlexplaatsingenService.<anonymous> (http://localhost:9876/src/app/services/flexplaatsingen.service.ts?:23:23) thrown