From fab766adb6ecb7349273439b5f576e47d5d53073 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 7 Oct 2021 16:11:33 +0100 Subject: [PATCH] Adding functionality to check if ethereal is down, if it is don't fail the test. --- .../worker/src/api/routes/tests/realEmail.spec.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/worker/src/api/routes/tests/realEmail.spec.js b/packages/worker/src/api/routes/tests/realEmail.spec.js index 845e31d911..f61aee830f 100644 --- a/packages/worker/src/api/routes/tests/realEmail.spec.js +++ b/packages/worker/src/api/routes/tests/realEmail.spec.js @@ -34,8 +34,18 @@ describe("/api/global/email", () => { const testUrl = nodemailer.getTestMessageUrl(res.body) console.log(`${purpose} URL: ${testUrl}`) expect(testUrl).toBeDefined() - const response = await fetch(testUrl) - const text = await response.text() + let response, text + try { + response = await fetch(testUrl) + text = await response.text() + } catch (err) { + // ethereal hiccup, can't test right now + if (err.status > 400) { + return + } else { + throw err + } + } let toCheckFor switch (purpose) { case EmailTemplatePurpose.WELCOME: