You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importhelperfrom'~/test_helpers'importAWSfrom'aws-sdk-mock'letprs=thethingthatsendstheemail// psudeo code paraphrasingletserver=helper.server;it('should send an email',async()=>{AWS.mock('SES','sendEmail',function(params,callback){console.log("here");callback(null,'success');});letresult=awaitprs.send_email(server);// this uses hapi-mail internallyAWS.restore('SES','sendEmail');}).timeout(20000);// sending an email takes longer than most things
It seems like the mock just isn't happening. I never see "here" printed in the test output and this is the error I get:
It appears that your prs is being instantiated and initialized outside of your mocked scope. My understanding is that the mock with be registered before creating the object depending on the mock.
The code you've referenced is creating the AWS.SES in its constructor, not when .SendEmail() is called.
Hello,
I can't figure out what is going wrong here. I'm trying to mock SES sendMail, which is used inside the hapi-mail package here: https://github.com/paullang/hapi-mail/blob/master/lib/email-ses.js#L12
My test looks something like this:
It seems like the mock just isn't happening. I never see "here" printed in the test output and this is the error I get:
I'm kind of at a loss for how to debug this. Any ideas?
The text was updated successfully, but these errors were encountered: