I am testing a function using this code:
return new Promise((ok, fail) => {
this.repository.findById(id, (error, result) => {
if (error)
return fail(error);
ok(result);
});
});
I want to check the path of failure, i.e. when the method findByIdcalls the callback with an error. I use sinon to create a stub for my method repositoryand it findById, but I don't know how to make a stub call a callback with the required parameters
Has anyone done something like this before?
thank
source
share