mardi 29 mars 2016

How to sinon stub a call to external module in a tested function

I am testing a function. That function has a call to an external module which makes my test fail:

element.funcCall();

Where the function looks like this:

function funcCall() {
    external.a.b.c.doSomething();
}

It fails on: undefined is not an object (evaluating 'external.a.b.c.doSomething')

How can I stub or fake this so the call is not really make. I do not need it's functionality for this test.

Aucun commentaire:

Enregistrer un commentaire