chrisgriffith/ionic-native-mocks

Super.apply is not a function (social-sharing-mock)

nathantaal opened this issue · 7 comments

I get the following error when running an unit test:

TypeError: _super.apply is not a function
	    at new SocialSharingMock (http://localhost:9876/node_modules/@ionic-native-mocks/social-sharing/index.js?:15:1)
	    at _createClass (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:8412:1)
	    at _createProviderInstance (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:8386:1)
	    at resolveNgModuleDep (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:8349:1)
	    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:9057:1)
	    at resolveDep (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:9422:1)
	    at createClass (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:9296:1)
	    at createDirectiveInstance (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:9179:1)
	    at createViewNodes (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:10399:1)
	    at createRootView (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:10313:1)
	Expected undefined to be truthy.
	    at UserContext.<anonymous> (http://localhost:9876/src/app/pages/bg/contact/contact.page.spec.ts?:31:27)
	    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/node_modules/zone.js/dist/zone.js?:388:1)
	    at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/node_modules/zone.js/dist/zone-testing.js?:288:1)
	    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/node_modules/zone.js/dist/zone.js?:387:1)

is the mock missing an function or is there something else happening?

So when opening social-sharing/index.js it imports { SocialSharing } from '@ionic-native/social-sharing'
When I change that import to { SocialSharing } from '@ionic-native/social-sharing/ngx' the tests pass.
This is because Ionic 4, any support plannend for it?

Yes. I am waiting on the dust to settle before I embark on the updates (and finish my Ionic 4 book).

Let me know if and when you have more info on that book :)

Getting this issue with the push mock. Any update on this?

Any update? most of the plugins are acting the same with
_super.apply is not a function

Unfortunately, I have not been working on this. Maybe during this quarantine I can devote some time to fully fixing it to use Ionic Native v5