Adding functionality to check if ethereal is down, if it is don't fail the test.

This commit is contained in:
mike12345567 2021-10-07 16:11:33 +01:00
parent 380d0e030e
commit 64b98a6d18
1 changed files with 12 additions and 2 deletions

View File

@ -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: