From efb09523a79c0a10662a066dfcefa5ac2cd3bb56 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 7 Oct 2021 16:14:00 +0100 Subject: [PATCH] Fixing a small issue with email test fix. --- .../src/api/routes/tests/realEmail.spec.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/worker/src/api/routes/tests/realEmail.spec.js b/packages/worker/src/api/routes/tests/realEmail.spec.js index f61aee830f..5ca2b54ebc 100644 --- a/packages/worker/src/api/routes/tests/realEmail.spec.js +++ b/packages/worker/src/api/routes/tests/realEmail.spec.js @@ -20,27 +20,27 @@ describe("/api/global/email", () => { await config.saveEtherealSmtpConfig() await config.saveSettingsConfig() const user = await config.getUser("test@test.com") - const res = await request - .post(`/api/global/email/send`) - .send({ - email: "test@test.com", - purpose, - userId: user._id, - }) - .set(config.defaultHeaders()) - .expect("Content-Type", /json/) - .expect(200) - expect(res.body.message).toBeDefined() - const testUrl = nodemailer.getTestMessageUrl(res.body) - console.log(`${purpose} URL: ${testUrl}`) - expect(testUrl).toBeDefined() let response, text try { + const res = await request + .post(`/api/global/email/send`) + .send({ + email: "test@test.com", + purpose, + userId: user._id, + }) + .set(config.defaultHeaders()) + .expect("Content-Type", /json/) + .expect(200) + expect(res.body.message).toBeDefined() + const testUrl = nodemailer.getTestMessageUrl(res.body) + console.log(`${purpose} URL: ${testUrl}`) + expect(testUrl).toBeDefined() response = await fetch(testUrl) text = await response.text() } catch (err) { // ethereal hiccup, can't test right now - if (err.status > 400) { + if (parseInt(err.status) > 400) { return } else { throw err