From a3182a76646128508b879205d2e025e62a5f2ea7 Mon Sep 17 00:00:00 2001 From: Fabien 'egg' O'Carroll Date: Mon, 24 Jan 2022 13:35:19 +0200 Subject: [PATCH] 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. --- test/regression/services/stripe.test.js | 38 ------------------------- 1 file changed, 38 deletions(-) delete mode 100644 test/regression/services/stripe.test.js diff --git a/test/regression/services/stripe.test.js b/test/regression/services/stripe.test.js deleted file mode 100644 index 575ec1aa97..0000000000 --- a/test/regression/services/stripe.test.js +++ /dev/null @@ -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); - }); -});