vendredi 13 décembre 2019

Is there any way to use callsFake with sinon spies?

I am trying to migrate from expect to chai and Sinon. I expect we do something like this

this.check = expect.spyOn(module, "method").andCall(function(dep) {
    return dep;
});

But I want this behavior with Chai and Sinon.

 this.check = sinon.spy(module, "method")

But how do I get the andCall as I refer the docs and I guess callsFake cant be call with spy and I don't really think this will have similar behavior with stud.

Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire