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 183b6e7b50
commit fab766adb6
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) const testUrl = nodemailer.getTestMessageUrl(res.body)
console.log(`${purpose} URL: ${testUrl}`) console.log(`${purpose} URL: ${testUrl}`)
expect(testUrl).toBeDefined() expect(testUrl).toBeDefined()
const response = await fetch(testUrl) let response, text
const text = await 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 let toCheckFor
switch (purpose) { switch (purpose) {
case EmailTemplatePurpose.WELCOME: case EmailTemplatePurpose.WELCOME: