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

How to throw an error in test mode #263

Open
danbergelt opened this issue Apr 12, 2020 · 0 comments
Open

How to throw an error in test mode #263

danbergelt opened this issue Apr 12, 2020 · 0 comments

Comments

@danbergelt
Copy link

danbergelt commented Apr 12, 2020

  1. What version of the module is the issue happening on? Does the issue happen on latest version?

0.22.0

  1. What platform and Node.js version? (For example Node.js 6.9.1 on Mac OS X)

Node.JS 12, Mac OS X

  1. Does the action work when you manually perform request against mailgun using curl (or other means)?

No

  1. Sample source code or steps to reproduce

I am attempting to run integration tests against an API controller which sends an email, and am having trouble figuring out if there is a way to force an email sent in test mode to throw. I have the below try/catch block:

    try {
      return await sendForgotPasswordEmail(body.email, link, res);
    } catch (_) {
      return catchForgotPasswordEmail(user, next);
    }

which handles the case when the sent email throws, but according to the documentation:

Note that in test mode no error or body are returned as a result.

Is there a way to reliably test a failed request without actually sending an email?

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

No branches or pull requests

1 participant