0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added test to check sending emails when Mailgun is not configured

- this tests the early-return path linked to Mailgun not being
  configured
This commit is contained in:
Daniel Lockyer 2022-08-11 08:55:53 +02:00
parent ddbee90c1c
commit f9b90a3cfe
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
2 changed files with 10 additions and 1 deletions

View file

@ -34,7 +34,7 @@ module.exports = class MailgunClient {
const mailgunInstance = this.getInstance();
if (!mailgunInstance) {
logging.warn(`Mailgun is not configured`);
return;
return null;
}
if (Object.keys(recipientData).length > module.exports.BATCH_SIZE) {

View file

@ -87,6 +87,15 @@ describe('MailgunClient', function () {
assert.equal(eventsMock2.isDone(), true);
});
describe('send()', function () {
it('does not send if not configured', async function () {
const mailgunClient = new MailgunClient({config, settings});
const response = await mailgunClient.send({}, {}, []);
assert.strictEqual(response, null);
});
});
describe('fetchEvents()', function () {
it('does not fetch if not configured', async function () {
const batchHandler = sinon.spy();