Mailer now ignores mailing erros when env is set to test

ref #154
This commit is contained in:
Nicolai Ort 2021-03-06 13:44:10 +01:00
parent cedc1750c2
commit 6bb3ae8ba9
2 changed files with 6 additions and 1 deletions

View File

@ -28,7 +28,9 @@ if (typeof config.development !== "boolean") {
if (config.mailer_url == "" || config.mailer_key == "") {
errors++;
}
console.log(config.testing)
if (config.testing) {
console.log("Discovered testing env. Ignoring all mailing errors!")
}
function getPhoneCodeLocale(): CountryCode {
return (process.env.PHONE_COUNTRYCODE as CountryCode);
}

View File

@ -23,6 +23,7 @@ export class Mailer {
resetKey: token
});
} catch (error) {
if (Mailer.testing) { return true; }
throw new MailSendingError();
}
}
@ -39,6 +40,7 @@ export class Mailer {
selfserviceToken: token
});
} catch (error) {
if (Mailer.testing) { return true; }
throw new MailSendingError();
}
}
@ -55,6 +57,7 @@ export class Mailer {
selfserviceToken: token
});
} catch (error) {
if (Mailer.testing) { return true; }
throw new MailSendingError();
}
}