chrisgriffith / ionic-native-mocks

Ionic Native Mocks are designed to be used as placeholders during development for the actual Ionic Native modules.
205 stars 42 forks source link

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

Open nathantaal opened 5 years ago

nathantaal commented 5 years ago

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?

nathantaal commented 5 years ago

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?

chrisgriffith commented 5 years ago

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

nathantaal commented 5 years ago

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

chrisgriffith commented 5 years ago

http://ionic-book.com/ :)

cpyle0819 commented 4 years ago

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

blahblehblah commented 4 years ago

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

chrisgriffith commented 4 years ago

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