0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Removed Stripe Service regression test (#14050)

no-issue

This test should have always been a unit test, but it now no longer
serves a purpose, as we do not rely on the event being emitted - it
would also not break Ghost if the event _was_ emitted, so we should not
be testing for that.
This commit is contained in:
Fabien 'egg' O'Carroll 2022-01-24 13:35:19 +02:00 committed by GitHub
parent 3ff3da1d99
commit a3182a7664
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,38 +0,0 @@
const sinon = require('sinon');
const rewire = require('rewire');
const events = require('events');
const rewiredStripeService = rewire('../../../core/server/services/stripe');
describe('Stripe Service', function () {
beforeEach(function () {
this.clock = sinon.useFakeTimers();
});
afterEach(function () {
this.clock.restore();
});
it('Does not emit a "services.stripe.reconfigured" event when it is reconfigured', async function () {
const eventsStub = new events.EventEmitter();
const configureApiStub = sinon.spy();
const emitReconfiguredEventSpy = sinon.spy(eventsStub, 'emit').withArgs('services.stripe.reconfigured');
rewiredStripeService.__set__('events', eventsStub);
await rewiredStripeService.init();
// This is _after_ init, because init calls configureApi, and we DGAF about that call.
rewiredStripeService.__set__('configureApi', configureApiStub);
eventsStub.emit('settings.edited', {
get: sinon.stub().withArgs('key').returns('stripe_connect_secret_key')
});
this.clock.tick(600);
sinon.assert.notCalled(emitReconfiguredEventSpy);
});
});