diff --git a/packages/worker/src/api/routes/tests/realEmail.spec.js b/packages/worker/src/api/routes/tests/realEmail.spec.js index 5ca2b54ebc..54238e9270 100644 --- a/packages/worker/src/api/routes/tests/realEmail.spec.js +++ b/packages/worker/src/api/routes/tests/realEmail.spec.js @@ -17,11 +17,11 @@ describe("/api/global/email", () => { afterAll(setup.afterAll) async function sendRealEmail(purpose) { - await config.saveEtherealSmtpConfig() - await config.saveSettingsConfig() - const user = await config.getUser("test@test.com") let response, text try { + await config.saveEtherealSmtpConfig() + await config.saveSettingsConfig() + const user = await config.getUser("test@test.com") const res = await request .post(`/api/global/email/send`) .send({ @@ -40,7 +40,7 @@ describe("/api/global/email", () => { text = await response.text() } catch (err) { // ethereal hiccup, can't test right now - if (parseInt(err.status) > 400) { + if (parseInt(err.status) >= 400) { return } else { throw err diff --git a/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js b/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js index 7f84de6b7d..9638e2a2a7 100644 --- a/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js +++ b/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js @@ -38,6 +38,9 @@ class TestConfiguration { request.request = { body: config, } + request.throw = (status, err) => { + throw { status, message: err } + } if (params) { request.params = params }