vendredi 17 avril 2020

How to call fake a constructor in Jasmine

Is it possible to call fake a constructor just like we do for functions?

My class is something like this

class testClass{
     constructor(){
        // to do class member init
        // how to avoid this method call.
        this.method();
     }

     private method() : weird class object {
         // to do method returns weird class object
     }
}

Is it possible to mock a constructor and avoid calling this.method().

i tried creating spy like this, but it did not work

jasmine.createSpy('testClass').and.callFake(() =>{})

Aucun commentaire:

Enregistrer un commentaire