mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added disableStripe method to mock manager
Some tests need to run without Stripe connected/enabled, which is the default at the moment. This method will disconnect stripe for the lifecycle of the API agent.
This commit is contained in:
parent
763a0f11cd
commit
f655ed3970
1 changed files with 9 additions and 0 deletions
|
@ -13,6 +13,14 @@ let emailCount = 0;
|
|||
const mailService = require('../../core/server/services/mail/index');
|
||||
const labs = require('../../core/shared/labs');
|
||||
|
||||
const disableStripe = async () => {
|
||||
// This must be required _after_ startGhost has been called, because the models will
|
||||
// not have been loaded otherwise. Consider moving the dependency injection of models
|
||||
// into the init method of the Stripe service.
|
||||
const stripeService = require('../../core/server/services/stripe');
|
||||
await stripeService.disconnect();
|
||||
};
|
||||
|
||||
const mockMail = () => {
|
||||
mocks.mail = sinon
|
||||
.stub(mailService.GhostMailer.prototype, 'send')
|
||||
|
@ -95,6 +103,7 @@ const restore = () => {
|
|||
|
||||
module.exports = {
|
||||
mockMail,
|
||||
disableStripe,
|
||||
mockStripe,
|
||||
mockLabsEnabled,
|
||||
mockLabsDisabled,
|
||||
|
|
Loading…
Add table
Reference in a new issue