Ionic native 3 Mockup question


I am trying to mock up the Network plugin with Ionic 3. I a actually juste trying to set the connection type to “wifi”.

Here is my function mockup function but it doesn’t seem to work. I do not know how to change the type variable of the parent class:

class NetworkMock extends Network {
      this.type = "wifi";

Thnaks in advance for your help.

Seconded. I also have the same issue.

This is just my personal opinion, but I think inheritance in JavaScript is so fraught with problems that it’s best avoided completely.

What I would do here instead is:

export class NetworkMock {
  type = "wifi";

export class AppModule {
  providers: [
    {provide: Network, useClass: NetworkMock}

You can flesh NetworkMock out further if needed, but don’t entangle it with the real class at all.