Skip to content
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

Don't Completely Mock Email Service #275

Open
steets250 opened this issue Jan 24, 2022 · 0 comments
Open

Don't Completely Mock Email Service #275

steets250 opened this issue Jan 24, 2022 · 0 comments
Labels

Comments

@steets250
Copy link
Member

steets250 commented Jan 24, 2022

When testing out that emails send correctly, we should verify that the ejs parses the given data correctly. Rather than doing when(emailService.sendOrderConfirmation(member.email, member.firstName, anything())).thenResolve();, we should actually call the function, and only mock this.sendEmail(data);. This will ensure that in the event an error is thrown (e.g. log.warn('Failed to send order confirmation email to ${email}', { error });), then the tests will catch this error. Otherwise, we're relying on the assumption that the .ejs templates will pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant