I'm writing a web app using nodejs. I have some utils functions which I export and test separately. There is another function though, that calls some of those utils functions that I would like to stub (using sinon).
From what I've seen so far, I can only stub methods on objects, so how should I design my utilities functions so I can test all of them?
function util1() {
...
}
function util2() {
...
}
function util3() {
...
util1();
...
util2();
}
export {
util1,
util2,
util3
}
Inside util3 I want to mock (or stub) the calls for util1 and util2.
Aucun commentaire:
Enregistrer un commentaire