Merge pull request #6685 from Budibase/fix/ethereal-test-case

Fix for ethereal test case failures
This commit is contained in:
Michael Drury 2022-07-13 16:08:44 +01:00 committed by GitHub
commit c2aace9d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ 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 // for the real email tests give them a long time to try complete/fail
jest.setTimeout(60000) jest.setTimeout(30000)
describe("/api/global/email", () => { describe("/api/global/email", () => {
@ -19,8 +19,14 @@ describe("/api/global/email", () => {
async function sendRealEmail(purpose) { async function sendRealEmail(purpose) {
let response, text let response, text
try { try {
await config.saveEtherealSmtpConfig() const timeout = () => new Promise((resolve, reject) =>
await config.saveSettingsConfig() 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 user = await config.getUser("test@test.com")
const res = await request const res = await request
.post(`/api/global/email/send`) .post(`/api/global/email/send`)