Make sure that ethereal tests don't fail on jest timeout.

This commit is contained in:
mike12345567 2022-03-30 14:41:39 +01:00
parent a7b84aaff6
commit 752a0f350e
1 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,9 @@ const { EmailTemplatePurpose } = require("../../../constants")
const nodemailer = require("nodemailer") const nodemailer = require("nodemailer")
const fetch = require("node-fetch") const fetch = require("node-fetch")
// for the real email tests give them a long time to try complete/fail
jest.setTimeout(30000)
describe("/api/global/email", () => { describe("/api/global/email", () => {
let request = setup.getRequest() let request = setup.getRequest()
let config = setup.getConfig() let config = setup.getConfig()
@ -27,6 +30,7 @@ describe("/api/global/email", () => {
userId: user._id, userId: user._id,
}) })
.set(config.defaultHeaders()) .set(config.defaultHeaders())
.timeout(20000)
// ethereal hiccup, can't test right now // ethereal hiccup, can't test right now
if (res.status >= 300) { if (res.status >= 300) {
return return
@ -39,7 +43,7 @@ describe("/api/global/email", () => {
text = await response.text() text = await response.text()
} catch (err) { } catch (err) {
// ethereal hiccup, can't test right now // ethereal hiccup, can't test right now
if (parseInt(err.status) >= 300) { if (parseInt(err.status) >= 300 || (err && err.errno === "ETIME")) {
return return
} else { } else {
throw err throw err