mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
309e14b8c9
refs https://github.com/TryGhost/Toolbox/issues/158 - Moving common mocking/stubbing/spying logic into an outside utils module allows test suites to keep agnostic towards which framework powers mocking etc. Should also substitute email service stubbing used in multiple places - Bonus, got rid of should dependency, which is deprecated
13 lines
335 B
JavaScript
13 lines
335 B
JavaScript
const sinon = require('sinon');
|
|
|
|
const mailService = require('../../core/server/services/mail/index');
|
|
|
|
const stubMail = () => {
|
|
return sinon
|
|
.stub(mailService.GhostMailer.prototype, 'send')
|
|
.resolves('Mail is disabled');
|
|
};
|
|
|
|
module.exports.stubMail = stubMail;
|
|
module.exports.restoreMocks = () => sinon.restore();
|