Closed samhstn closed 7 years ago
@shouston3 thank you for creating this issue/question! 😻
We have a little experience using Sinon in aws-sdk-mock
it might be worth checking if this object-based method calling will work with Sinon before changing the API.
could you do the following:
var email = require('sendemail').email;
email('welcome', person, function (error, result) {
// etc
}
BTW: I'm 100% "On Board" with adding the default method to be the
As far as I'm aware, you would only be able to overwrite methods of a required in object, not a required in function.
When testing functions/endpoints that use
sendemail
, I would like to be able to stub out thesendemail
function to avoid sending an actual email every time I run my tests (it slows down tests and fills up inboxes).Libraries like sinon follow the pattern of
sinon.stub(module, 'methodToStub')
.This module currently doesn't facilitate this pattern.
Would you consider changing the api to something like:
instead of:
I'm happy to do this if you don't mind the api change