Fixing another issue with ethereal test package.

This commit is contained in:
mike12345567 2021-10-07 16:35:11 +01:00
parent a4014c5580
commit b267698caa
2 changed files with 7 additions and 4 deletions

View File

@ -17,11 +17,11 @@ describe("/api/global/email", () => {
afterAll(setup.afterAll) afterAll(setup.afterAll)
async function sendRealEmail(purpose) { async function sendRealEmail(purpose) {
await config.saveEtherealSmtpConfig()
await config.saveSettingsConfig()
const user = await config.getUser("test@test.com")
let response, text let response, text
try { try {
await config.saveEtherealSmtpConfig()
await config.saveSettingsConfig()
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`)
.send({ .send({
@ -40,7 +40,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) > 400) { if (parseInt(err.status) >= 400) {
return return
} else { } else {
throw err throw err

View File

@ -38,6 +38,9 @@ class TestConfiguration {
request.request = { request.request = {
body: config, body: config,
} }
request.throw = (status, err) => {
throw { status, message: err }
}
if (params) { if (params) {
request.params = params request.params = params
} }