-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup/testing #9
Conversation
Add createMessage as a method of mail Refactor sendMail arrow funtion to regular function to have access to the mail object as "this"
sinon tap point-of-view fastify-nodemailer
use fastify.hasDecorator() to check for "mail"
single quotes -> double quotes to mimic fastify-plugin dependency error message
calls nodemailer.sendMail with correct arguments
fastify.nodemailer.sendMail = sinon.stub().returnsArg(0) | ||
const queued = await fastify.mail.sendMail(testContext) | ||
const { html } = queued | ||
t.error(sinon.assert.calledOnce(fastify.nodemailer.sendMail), 'nodemailer.sendMail is called') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a calledOnceWithExactly
that we could use here as well.
https://sinonjs.org/releases/latest/assertions/
Not a requested change, but just an fyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, LGTM
Summary
Test Plan