Browse Source

Quick fix for realEmail test which was causing problems.

pull/6685/head
mike12345567 4 years ago
parent
commit
b860e05fe8
  1. 12
      packages/worker/src/api/routes/tests/realEmail.spec.js

12
packages/worker/src/api/routes/tests/realEmail.spec.js

@ -4,7 +4,7 @@ const nodemailer = require("nodemailer")
const fetch = require("node-fetch")
// for the real email tests give them a long time to try complete/fail
jest.setTimeout(60000)
jest.setTimeout(30000)
describe("/api/global/email", () => {
@ -19,8 +19,14 @@ describe("/api/global/email", () => {
async function sendRealEmail(purpose) {
let response, text
try {
await config.saveEtherealSmtpConfig()
await config.saveSettingsConfig()
const timeout = () => new Promise((resolve, reject) =>
setTimeout(() => reject({
status: 301,
errno: "ETIME"
}), 20000)
)
await Promise.race([config.saveEtherealSmtpConfig(), timeout()])
await Promise.race([config.saveSettingsConfig(), timeout()])
const user = await config.getUser("test@test.com")
const res = await request
.post(`/api/global/email/send`)

Loading…
Cancel
Save