mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Fixed missing stub for DNS in GhostMailer Direct tests
- without this, Node will try and resolve the domain name but local DNS resolvers can take a while to timeout, which causes the tests to timeout - `nodemailer-direct-transport` calls `dns.resolveMx`, so if we stub that function and return an empty array, we can avoid any real DNS lookups
This commit is contained in:
parent
a6654b5e6c
commit
1b0adcf4ab
@ -1,3 +1,4 @@
|
|||||||
|
const dns = require('dns');
|
||||||
const should = require('should');
|
const should = require('should');
|
||||||
const sinon = require('sinon');
|
const sinon = require('sinon');
|
||||||
const mail = require('../../../../../core/server/services/mail');
|
const mail = require('../../../../../core/server/services/mail');
|
||||||
@ -115,10 +116,13 @@ describe('Mail: Ghostmailer', function () {
|
|||||||
configUtils.set({mail: {}});
|
configUtils.set({mail: {}});
|
||||||
|
|
||||||
mailer = new mail.GhostMailer();
|
mailer = new mail.GhostMailer();
|
||||||
|
|
||||||
|
sinon.stub(dns, 'resolveMx').yields(null, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
mailer = null;
|
mailer = null;
|
||||||
|
sinon.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('return correct failure message for domain doesn\'t exist', async function () {
|
it('return correct failure message for domain doesn\'t exist', async function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user