diff --git a/package-lock.json b/package-lock.json index 976beba2db..14704ed381 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,23 +157,40 @@ "symbol-observable": "^1.2.0" } }, - "@sinonjs/formatio": { - "version": "2.0.0", - "resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz", - "integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==", + "@sinonjs/commons": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.0.2.tgz", + "integrity": "sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw==", "dev": true, "requires": { - "samsam": "1.3.0" + "type-detect": "4.0.8" + } + }, + "@sinonjs/formatio": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", + "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", + "dev": true, + "requires": { + "@sinonjs/samsam": "2.1.0" + }, + "dependencies": { + "@sinonjs/samsam": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", + "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", + "dev": true, + "requires": { + "array-from": "^2.1.1" + } + } } }, "@sinonjs/samsam": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.0.tgz", - "integrity": "sha512-5x2kFgJYupaF1ns/RmharQ90lQkd2ELS8A9X0ymkAAdemYHGtI2KiUHG8nX2WU0T1qgnOU5YMqnBM2V7NUanNw==", - "dev": true, - "requires": { - "array-from": "^2.1.1" - } + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-2.1.2.tgz", + "integrity": "sha512-ZwTHAlC9akprWDinwEPD4kOuwaYZlyMwVJIANsKNC3QVp0AHB04m7RnB4eqeWfgmxw8MGTzS9uMaw93Z3QcZbw==", + "dev": true }, "@slack/client": { "version": "3.16.0", @@ -17578,15 +17595,6 @@ "text-encoding": "^0.6.4" }, "dependencies": { - "@sinonjs/formatio": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.0.0.tgz", - "integrity": "sha512-vdjoYLDptCgvtJs57ULshak3iJe4NW3sJ3g36xVDGff5AE8P30S6A093EIEPjdi2noGhfuNOEkbxt3J3awFW1w==", - "dev": true, - "requires": { - "@sinonjs/samsam": "2.1.0" - } - }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -23509,20 +23517,28 @@ "integrity": "sha1-BcLuxXn//+FFoDCsJs/qYbmA+r4=" }, "sinon": { - "version": "4.5.0", - "resolved": "http://registry.npmjs.org/sinon/-/sinon-4.5.0.tgz", - "integrity": "sha512-trdx+mB0VBBgoYucy6a9L7/jfQOmvGeaKZT4OOJ+lPAtI8623xyGr8wLiE4eojzBS8G9yXbhx42GHUOVLr4X2w==", + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-6.3.5.tgz", + "integrity": "sha512-xgoZ2gKjyVRcF08RrIQc+srnSyY1JDJtxu3Nsz07j1ffjgXoY6uPLf/qja6nDBZgzYYEovVkFryw2+KiZz11xQ==", "dev": true, "requires": { - "@sinonjs/formatio": "^2.0.0", - "diff": "^3.1.0", + "@sinonjs/commons": "^1.0.2", + "@sinonjs/formatio": "^3.0.0", + "@sinonjs/samsam": "^2.1.2", + "diff": "^3.5.0", "lodash.get": "^4.4.2", - "lolex": "^2.2.0", - "nise": "^1.2.0", - "supports-color": "^5.1.0", - "type-detect": "^4.0.5" + "lolex": "^2.7.5", + "nise": "^1.4.5", + "supports-color": "^5.5.0", + "type-detect": "^4.0.8" }, "dependencies": { + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, "lolex": { "version": "2.7.5", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", diff --git a/package.json b/package.json index b16afccabe..0a6fe24e5e 100644 --- a/package.json +++ b/package.json @@ -183,7 +183,7 @@ "puppeteer": "^1.4.0", "require-again": "^2.0.0", "selenium-server": "^3.12.0", - "sinon": "^4.5.0", + "sinon": "^6.3.5", "sinon-chai": "^3.0.0", "sinon-stub-promise": "^4.0.0", "webpack-bundle-analyzer": "^2.12.0", diff --git a/test/api/unit/libs/payments/amazon/cancel.test.js b/test/api/unit/libs/payments/amazon/cancel.test.js index bade9a6add..ab0f2ebf8c 100644 --- a/test/api/unit/libs/payments/amazon/cancel.test.js +++ b/test/api/unit/libs/payments/amazon/cancel.test.js @@ -48,7 +48,6 @@ describe('Amazon Payments - Cancel Subscription', () => { function expectBillingAggreementDetailSpy () { getBillingAgreementDetailsSpy = sinon.stub(amzLib, 'getBillingAgreementDetails') - .returnsPromise() .resolves({ BillingAgreementDetails: { BillingAgreementStatus: {State: 'Open'}, @@ -80,14 +79,14 @@ describe('Amazon Payments - Cancel Subscription', () => { headers = {}; getBillingAgreementDetailsSpy = sinon.stub(amzLib, 'getBillingAgreementDetails'); - getBillingAgreementDetailsSpy.returnsPromise().resolves({ + getBillingAgreementDetailsSpy.resolves({ BillingAgreementDetails: { BillingAgreementStatus: {State: 'Closed'}, }, }); paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription'); - paymentCancelSubscriptionSpy.returnsPromise().resolves({}); + paymentCancelSubscriptionSpy.resolves({}); }); afterEach(function () { @@ -118,7 +117,7 @@ describe('Amazon Payments - Cancel Subscription', () => { it('should close a user subscription if amazon not closed', async () => { amzLib.getBillingAgreementDetails.restore(); expectBillingAggreementDetailSpy(); - let closeBillingAgreementSpy = sinon.stub(amzLib, 'closeBillingAgreement').returnsPromise().resolves({}); + let closeBillingAgreementSpy = sinon.stub(amzLib, 'closeBillingAgreement').resolves({}); billingAgreementId = user.purchased.plan.customerId; await amzLib.cancelSubscription({user, headers}); @@ -164,7 +163,7 @@ describe('Amazon Payments - Cancel Subscription', () => { it('should close a group subscription if amazon not closed', async () => { amzLib.getBillingAgreementDetails.restore(); expectBillingAggreementDetailSpy(); - let closeBillingAgreementSpy = sinon.stub(amzLib, 'closeBillingAgreement').returnsPromise().resolves({}); + let closeBillingAgreementSpy = sinon.stub(amzLib, 'closeBillingAgreement').resolves({}); billingAgreementId = group.purchased.plan.customerId; await amzLib.cancelSubscription({user, groupId: group._id, headers}); diff --git a/test/api/unit/libs/payments/amazon/checkout.test.js b/test/api/unit/libs/payments/amazon/checkout.test.js index e9224c481b..4e220bb26b 100644 --- a/test/api/unit/libs/payments/amazon/checkout.test.js +++ b/test/api/unit/libs/payments/amazon/checkout.test.js @@ -68,22 +68,22 @@ describe('Amazon Payments - Checkout', () => { orderReferenceId = 'orderReferenceId'; setOrderReferenceDetailsSpy = sinon.stub(amzLib, 'setOrderReferenceDetails'); - setOrderReferenceDetailsSpy.returnsPromise().resolves({}); + setOrderReferenceDetailsSpy.resolves({}); confirmOrderReferenceSpy = sinon.stub(amzLib, 'confirmOrderReference'); - confirmOrderReferenceSpy.returnsPromise().resolves({}); + confirmOrderReferenceSpy.resolves({}); authorizeSpy = sinon.stub(amzLib, 'authorize'); - authorizeSpy.returnsPromise().resolves({}); + authorizeSpy.resolves({}); closeOrderReferenceSpy = sinon.stub(amzLib, 'closeOrderReference'); - closeOrderReferenceSpy.returnsPromise().resolves({}); + closeOrderReferenceSpy.resolves({}); paymentBuyGemsStub = sinon.stub(payments, 'buyGems'); - paymentBuyGemsStub.returnsPromise().resolves({}); + paymentBuyGemsStub.resolves({}); paymentCreateSubscritionStub = sinon.stub(payments, 'createSubscription'); - paymentCreateSubscritionStub.returnsPromise().resolves({}); + paymentCreateSubscritionStub.resolves({}); sinon.stub(common, 'uuid').returns('uuid-generated'); }); @@ -111,7 +111,7 @@ describe('Amazon Payments - Checkout', () => { } it('should purchase gems', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(true); + sinon.stub(user, 'canGetGems').resolves(true); await amzLib.checkout({user, orderReferenceId, headers}); expectBuyGemsStub(amzLib.constants.PAYMENT_METHOD); @@ -140,7 +140,7 @@ describe('Amazon Payments - Checkout', () => { }); it('should error if user cannot get gems gems', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(false); + sinon.stub(user, 'canGetGems').resolves(false); await expect(amzLib.checkout({user, orderReferenceId, headers})).to.eventually.be.rejected.and.to.eql({ httpCode: 401, message: i18n.t('groupPolicyCannotGetGems'), diff --git a/test/api/unit/libs/payments/amazon/subscribe.test.js b/test/api/unit/libs/payments/amazon/subscribe.test.js index aa60291c5d..d42c80d96c 100644 --- a/test/api/unit/libs/payments/amazon/subscribe.test.js +++ b/test/api/unit/libs/payments/amazon/subscribe.test.js @@ -46,16 +46,16 @@ describe('Amazon Payments - Subscribe', () => { headers = {}; amazonSetBillingAgreementDetailsSpy = sinon.stub(amzLib, 'setBillingAgreementDetails'); - amazonSetBillingAgreementDetailsSpy.returnsPromise().resolves({}); + amazonSetBillingAgreementDetailsSpy.resolves({}); amazonConfirmBillingAgreementSpy = sinon.stub(amzLib, 'confirmBillingAgreement'); - amazonConfirmBillingAgreementSpy.returnsPromise().resolves({}); + amazonConfirmBillingAgreementSpy.resolves({}); amazonAuthorizeOnBillingAgreementSpy = sinon.stub(amzLib, 'authorizeOnBillingAgreement'); - amazonAuthorizeOnBillingAgreementSpy.returnsPromise().resolves({}); + amazonAuthorizeOnBillingAgreementSpy.resolves({}); createSubSpy = sinon.stub(payments, 'createSubscription'); - createSubSpy.returnsPromise().resolves({}); + createSubSpy.resolves({}); sinon.stub(common, 'uuid').returns('uuid-generated'); }); diff --git a/test/api/unit/libs/payments/amazon/upgrade-groupplan.test.js b/test/api/unit/libs/payments/amazon/upgrade-groupplan.test.js index bc9f9a76c4..f846738acc 100644 --- a/test/api/unit/libs/payments/amazon/upgrade-groupplan.test.js +++ b/test/api/unit/libs/payments/amazon/upgrade-groupplan.test.js @@ -37,7 +37,7 @@ describe('#upgradeGroupPlan', () => { await group.save(); spy = sinon.stub(amzLib, 'authorizeOnBillingAgreement'); - spy.returnsPromise().resolves([]); + spy.resolves([]); uuidString = 'uuid-v4'; sinon.stub(uuid, 'v4').returns(uuidString); diff --git a/test/api/unit/libs/payments/apple.test.js b/test/api/unit/libs/payments/apple.test.js index f61998d04b..bdf23bfa33 100644 --- a/test/api/unit/libs/payments/apple.test.js +++ b/test/api/unit/libs/payments/apple.test.js @@ -24,16 +24,16 @@ describe('Apple Payments', () => { headers = {}; iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({}); + .resolves({}); iapIsValidatedStub = sinon.stub(iapModule, 'isValidated') .returns(true); iapGetPurchaseDataStub = sinon.stub(iapModule, 'getPurchaseData') .returns([{productId: 'com.habitrpg.ios.Habitica.21gems', transactionId: token, }]); - paymentBuyGemsStub = sinon.stub(payments, 'buyGems').returnsPromise().resolves({}); + paymentBuyGemsStub = sinon.stub(payments, 'buyGems').resolves({}); }); afterEach(() => { @@ -70,7 +70,7 @@ describe('Apple Payments', () => { }); it('errors if the user cannot purchase gems', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(false); + sinon.stub(user, 'canGetGems').resolves(false); await expect(applePayments.verifyGemPurchase(user, receipt, headers)) .to.eventually.be.rejected.and.to.eql({ httpCode: 401, @@ -82,7 +82,7 @@ describe('Apple Payments', () => { }); it('errors if amount does not exist', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(true); + sinon.stub(user, 'canGetGems').resolves(true); iapGetPurchaseDataStub.restore(); iapGetPurchaseDataStub = sinon.stub(iapModule, 'getPurchaseData') .returns([{productId: 'badProduct', @@ -130,7 +130,7 @@ describe('Apple Payments', () => { transactionId: token, }]); - sinon.stub(user, 'canGetGems').returnsPromise().resolves(true); + sinon.stub(user, 'canGetGems').resolves(true); await applePayments.verifyGemPurchase(user, receipt, headers); expect(iapSetupStub).to.be.calledOnce; @@ -167,9 +167,9 @@ describe('Apple Payments', () => { nextPaymentProcessing = moment.utc().add({days: 2}); iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({}); + .resolves({}); iapIsValidatedStub = sinon.stub(iapModule, 'isValidated') .returns(true); iapGetPurchaseDataStub = sinon.stub(iapModule, 'getPurchaseData') @@ -186,7 +186,7 @@ describe('Apple Payments', () => { productId: sku, transactionId: token, }]); - paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').returnsPromise().resolves({}); + paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').resolves({}); }); afterEach(() => { @@ -297,9 +297,9 @@ describe('Apple Payments', () => { expirationDate = moment.utc(); iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({ + .resolves({ expirationDate, }); iapGetPurchaseDataStub = sinon.stub(iapModule, 'getPurchaseData') @@ -314,7 +314,7 @@ describe('Apple Payments', () => { user.purchased.plan.planId = subKey; user.purchased.plan.additionalData = receipt; - paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').resolves({}); }); afterEach(function () { diff --git a/test/api/unit/libs/payments/google.test.js b/test/api/unit/libs/payments/google.test.js index d9fa56b988..8f66f26c1a 100644 --- a/test/api/unit/libs/payments/google.test.js +++ b/test/api/unit/libs/payments/google.test.js @@ -24,12 +24,12 @@ describe('Google Payments', () => { headers = {}; iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({}); + .resolves({}); iapIsValidatedStub = sinon.stub(iapModule, 'isValidated') .returns(true); - paymentBuyGemsStub = sinon.stub(payments, 'buyGems').returnsPromise().resolves({}); + paymentBuyGemsStub = sinon.stub(payments, 'buyGems').resolves({}); }); afterEach(() => { @@ -64,7 +64,7 @@ describe('Google Payments', () => { }); it('should throw an error if user cannot purchase gems', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(false); + sinon.stub(user, 'canGetGems').resolves(false); await expect(googlePayments.verifyGemPurchase(user, receipt, signature, headers)) .to.eventually.be.rejected.and.to.eql({ @@ -77,7 +77,7 @@ describe('Google Payments', () => { }); it('purchases gems', async () => { - sinon.stub(user, 'canGetGems').returnsPromise().resolves(true); + sinon.stub(user, 'canGetGems').resolves(true); await googlePayments.verifyGemPurchase(user, receipt, signature, headers); expect(iapSetupStub).to.be.calledOnce; @@ -116,12 +116,12 @@ describe('Google Payments', () => { nextPaymentProcessing = moment.utc().add({days: 2}); iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({}); + .resolves({}); iapIsValidatedStub = sinon.stub(iapModule, 'isValidated') .returns(true); - paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').returnsPromise().resolves({}); + paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').resolves({}); }); afterEach(() => { @@ -193,9 +193,9 @@ describe('Google Payments', () => { expirationDate = moment.utc(); iapSetupStub = sinon.stub(iapModule, 'setup') - .returnsPromise().resolves(); + .resolves(); iapValidateStub = sinon.stub(iapModule, 'validate') - .returnsPromise().resolves({ + .resolves({ expirationDate, }); iapGetPurchaseDataStub = sinon.stub(iapModule, 'getPurchaseData') @@ -210,7 +210,7 @@ describe('Google Payments', () => { user.purchased.plan.planId = subKey; user.purchased.plan.additionalData = {data: receipt, signature}; - paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').resolves({}); }); afterEach(function () { diff --git a/test/api/unit/libs/payments/group-plans/group-payments-create.test.js b/test/api/unit/libs/payments/group-plans/group-payments-create.test.js index 1ce795d527..3e57126ef0 100644 --- a/test/api/unit/libs/payments/group-plans/group-payments-create.test.js +++ b/test/api/unit/libs/payments/group-plans/group-payments-create.test.js @@ -69,11 +69,11 @@ describe('Purchasing a group plan for group', () => { }; let subscriptionId = 'subId'; - sinon.stub(stripe.customers, 'del').returnsPromise().resolves({}); + sinon.stub(stripe.customers, 'del').resolves({}); let currentPeriodEndTimeStamp = moment().add(3, 'months').unix(); sinon.stub(stripe.customers, 'retrieve') - .returnsPromise().resolves({ + .resolves({ subscriptions: { data: [{id: subscriptionId, current_period_end: currentPeriodEndTimeStamp}], // eslint-disable-line camelcase }, @@ -216,7 +216,6 @@ describe('Purchasing a group plan for group', () => { it('sends one email to subscribed member of group, stating subscription is cancelled (Amazon)', async () => { sinon.stub(amzLib, 'getBillingAgreementDetails') - .returnsPromise() .resolves({ BillingAgreementDetails: { BillingAgreementStatus: {State: 'Closed'}, @@ -251,9 +250,9 @@ describe('Purchasing a group plan for group', () => { }); it('sends one email to subscribed member of group, stating subscription is cancelled (PayPal)', async () => { - sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').returnsPromise().resolves({}); + sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').resolves({}); sinon.stub(paypalPayments, 'paypalBillingAgreementGet') - .returnsPromise().resolves({ + .resolves({ agreement_details: { // eslint-disable-line camelcase next_billing_date: moment().add(3, 'months').toDate(), // eslint-disable-line camelcase cycles_completed: 1, // eslint-disable-line camelcase @@ -449,7 +448,6 @@ describe('Purchasing a group plan for group', () => { it('adds months to members with existing recurring subscription (Amazon)', async () => { sinon.stub(amzLib, 'getBillingAgreementDetails') - .returnsPromise() .resolves({ BillingAgreementDetails: { BillingAgreementStatus: {State: 'Closed'}, @@ -478,9 +476,9 @@ describe('Purchasing a group plan for group', () => { }); it('adds months to members with existing recurring subscription (Paypal)', async () => { - sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').returnsPromise().resolves({}); + sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').resolves({}); sinon.stub(paypalPayments, 'paypalBillingAgreementGet') - .returnsPromise().resolves({ + .resolves({ agreement_details: { // eslint-disable-line camelcase next_billing_date: moment().add(3, 'months').toDate(), // eslint-disable-line camelcase cycles_completed: 1, // eslint-disable-line camelcase diff --git a/test/api/unit/libs/payments/paypal/checkout-success.test.js b/test/api/unit/libs/payments/paypal/checkout-success.test.js index 79568c7abf..80547925b4 100644 --- a/test/api/unit/libs/payments/paypal/checkout-success.test.js +++ b/test/api/unit/libs/payments/paypal/checkout-success.test.js @@ -13,9 +13,9 @@ describe('checkout success', () => { customerId = 'customerId-test'; paymentId = 'paymentId-test'; - paypalPaymentExecuteStub = sinon.stub(paypalPayments, 'paypalPaymentExecute').returnsPromise().resolves({}); - paymentBuyGemsStub = sinon.stub(payments, 'buyGems').returnsPromise().resolves({}); - paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').returnsPromise().resolves({}); + paypalPaymentExecuteStub = sinon.stub(paypalPayments, 'paypalPaymentExecute').resolves({}); + paymentBuyGemsStub = sinon.stub(payments, 'buyGems').resolves({}); + paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').resolves({}); }); afterEach(() => { diff --git a/test/api/unit/libs/payments/paypal/checkout.test.js b/test/api/unit/libs/payments/paypal/checkout.test.js index 469330cd5d..4b45b0dca7 100644 --- a/test/api/unit/libs/payments/paypal/checkout.test.js +++ b/test/api/unit/libs/payments/paypal/checkout.test.js @@ -42,7 +42,7 @@ describe('checkout', () => { beforeEach(() => { approvalHerf = 'approval_href'; paypalPaymentCreateStub = sinon.stub(paypalPayments, 'paypalPaymentCreate') - .returnsPromise().resolves({ + .resolves({ links: [{ rel: 'approval_url', href: approvalHerf }], }); }); @@ -80,7 +80,7 @@ describe('checkout', () => { it('should error if the user cannot get gems', async () => { let user = new User(); - sinon.stub(user, 'canGetGems').returnsPromise().resolves(false); + sinon.stub(user, 'canGetGems').resolves(false); await expect(paypalPayments.checkout({user})).to.eventually.be.rejected.and.to.eql({ httpCode: 401, diff --git a/test/api/unit/libs/payments/paypal/ipn.test.js b/test/api/unit/libs/payments/paypal/ipn.test.js index 007ba794b4..0fe6c8a455 100644 --- a/test/api/unit/libs/payments/paypal/ipn.test.js +++ b/test/api/unit/libs/payments/paypal/ipn.test.js @@ -34,8 +34,8 @@ describe('ipn', () => { group.purchased.plan.lastBillingDate = new Date(); await group.save(); - ipnVerifyAsyncStub = sinon.stub(paypalPayments, 'ipnVerifyAsync').returnsPromise().resolves({}); - paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + ipnVerifyAsyncStub = sinon.stub(paypalPayments, 'ipnVerifyAsync').resolves({}); + paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').resolves({}); }); afterEach(function () { diff --git a/test/api/unit/libs/payments/paypal/subscribe-cancel.test.js b/test/api/unit/libs/payments/paypal/subscribe-cancel.test.js index 7bbb3806ef..e0f195f0d2 100644 --- a/test/api/unit/libs/payments/paypal/subscribe-cancel.test.js +++ b/test/api/unit/libs/payments/paypal/subscribe-cancel.test.js @@ -38,15 +38,15 @@ describe('subscribeCancel', () => { nextBillingDate = new Date(); - paypalBillingAgreementCancelStub = sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').returnsPromise().resolves({}); + paypalBillingAgreementCancelStub = sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').resolves({}); paypalBillingAgreementGetStub = sinon.stub(paypalPayments, 'paypalBillingAgreementGet') - .returnsPromise().resolves({ + .resolves({ agreement_details: { next_billing_date: nextBillingDate, cycles_completed: 1, }, }); - paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + paymentCancelSubscriptionSpy = sinon.stub(payments, 'cancelSubscription').resolves({}); }); afterEach(function () { diff --git a/test/api/unit/libs/payments/paypal/subscribe-success.test.js b/test/api/unit/libs/payments/paypal/subscribe-success.test.js index ad03248227..6c2edbf73c 100644 --- a/test/api/unit/libs/payments/paypal/subscribe-success.test.js +++ b/test/api/unit/libs/payments/paypal/subscribe-success.test.js @@ -28,10 +28,10 @@ describe('subscribeSuccess', () => { customerId = 'test-customerId'; paypalBillingAgreementExecuteStub = sinon.stub(paypalPayments, 'paypalBillingAgreementExecute') - .returnsPromise({}).resolves({ + .resolves({ id: customerId, }); - paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').returnsPromise().resolves({}); + paymentsCreateSubscritionStub = sinon.stub(payments, 'createSubscription').resolves({}); }); afterEach(() => { diff --git a/test/api/unit/libs/payments/paypal/subscribe.test.js b/test/api/unit/libs/payments/paypal/subscribe.test.js index 961882ed10..d167d7087d 100644 --- a/test/api/unit/libs/payments/paypal/subscribe.test.js +++ b/test/api/unit/libs/payments/paypal/subscribe.test.js @@ -18,7 +18,7 @@ describe('subscribe', () => { sub = Object.assign({}, common.content.subscriptionBlocks[subKey]); paypalBillingAgreementCreateStub = sinon.stub(paypalPayments, 'paypalBillingAgreementCreate') - .returnsPromise().resolves({ + .resolves({ links: [{ rel: 'approval_url', href: approvalHerf }], }); }); diff --git a/test/api/unit/libs/payments/stripe/cancel-subscription.test.js b/test/api/unit/libs/payments/stripe/cancel-subscription.test.js index 4542455d99..64750dab8f 100644 --- a/test/api/unit/libs/payments/stripe/cancel-subscription.test.js +++ b/test/api/unit/libs/payments/stripe/cancel-subscription.test.js @@ -82,12 +82,12 @@ describe('cancel subscription', () => { beforeEach(() => { subscriptionId = 'subId'; - stripeDeleteCustomerStub = sinon.stub(stripe.customers, 'del').returnsPromise().resolves({}); - paymentsCancelSubStub = sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + stripeDeleteCustomerStub = sinon.stub(stripe.customers, 'del').resolves({}); + paymentsCancelSubStub = sinon.stub(payments, 'cancelSubscription').resolves({}); currentPeriodEndTimeStamp = (new Date()).getTime(); stripeRetrieveStub = sinon.stub(stripe.customers, 'retrieve') - .returnsPromise().resolves({ + .resolves({ subscriptions: { data: [{id: subscriptionId, current_period_end: currentPeriodEndTimeStamp}], // eslint-disable-line camelcase }, diff --git a/test/api/unit/libs/payments/stripe/checkout-subscription.test.js b/test/api/unit/libs/payments/stripe/checkout-subscription.test.js index f17f5c7da5..9a47d7fffe 100644 --- a/test/api/unit/libs/payments/stripe/checkout-subscription.test.js +++ b/test/api/unit/libs/payments/stripe/checkout-subscription.test.js @@ -54,7 +54,7 @@ describe('checkout with subscription', () => { token = 'test-token'; spy = sinon.stub(stripe.subscriptions, 'update'); - spy.returnsPromise().resolves; + spy.resolves; stripeCreateCustomerSpy = sinon.stub(stripe.customers, 'create'); let stripCustomerResponse = { @@ -63,10 +63,10 @@ describe('checkout with subscription', () => { data: [{id: subscriptionId}], }, }; - stripeCreateCustomerSpy.returnsPromise().resolves(stripCustomerResponse); + stripeCreateCustomerSpy.resolves(stripCustomerResponse); stripePaymentsCreateSubSpy = sinon.stub(payments, 'createSubscription'); - stripePaymentsCreateSubSpy.returnsPromise().resolves({}); + stripePaymentsCreateSubSpy.resolves({}); data.groupId = group._id; data.sub.quantity = 3; diff --git a/test/api/unit/libs/payments/stripe/checkout.test.js b/test/api/unit/libs/payments/stripe/checkout.test.js index c45e311873..37a89e4e70 100644 --- a/test/api/unit/libs/payments/stripe/checkout.test.js +++ b/test/api/unit/libs/payments/stripe/checkout.test.js @@ -26,9 +26,9 @@ describe('checkout', () => { let stripCustomerResponse = { id: customerIdResponse, }; - stripeChargeStub = sinon.stub(stripe.charges, 'create').returnsPromise().resolves(stripCustomerResponse); - paymentBuyGemsStub = sinon.stub(payments, 'buyGems').returnsPromise().resolves({}); - paymentCreateSubscritionStub = sinon.stub(payments, 'createSubscription').returnsPromise().resolves({}); + stripeChargeStub = sinon.stub(stripe.charges, 'create').resolves(stripCustomerResponse); + paymentBuyGemsStub = sinon.stub(payments, 'buyGems').resolves({}); + paymentCreateSubscritionStub = sinon.stub(payments, 'createSubscription').resolves({}); }); afterEach(() => { @@ -82,7 +82,7 @@ describe('checkout', () => { it('should error if user cannot get gems', async () => { gift = undefined; - sinon.stub(user, 'canGetGems').returnsPromise().resolves(false); + sinon.stub(user, 'canGetGems').resolves(false); await expect(stripePayments.checkout({ token, @@ -101,7 +101,7 @@ describe('checkout', () => { it('should purchase gems', async () => { gift = undefined; - sinon.stub(user, 'canGetGems').returnsPromise().resolves(true); + sinon.stub(user, 'canGetGems').resolves(true); await stripePayments.checkout({ token, diff --git a/test/api/unit/libs/payments/stripe/edit-subscription.test.js b/test/api/unit/libs/payments/stripe/edit-subscription.test.js index 59c8c52701..6cbcd1662b 100644 --- a/test/api/unit/libs/payments/stripe/edit-subscription.test.js +++ b/test/api/unit/libs/payments/stripe/edit-subscription.test.js @@ -98,11 +98,11 @@ describe('edit subscription', () => { beforeEach(() => { subscriptionId = 'subId'; stripeListSubscriptionStub = sinon.stub(stripe.customers, 'listSubscriptions') - .returnsPromise().resolves({ + .resolves({ data: [{id: subscriptionId}], }); - stripeUpdateSubscriptionStub = sinon.stub(stripe.customers, 'updateSubscription').returnsPromise().resolves({}); + stripeUpdateSubscriptionStub = sinon.stub(stripe.customers, 'updateSubscription').resolves({}); }); afterEach(() => { diff --git a/test/api/unit/libs/payments/stripe/handle-webhook.test.js b/test/api/unit/libs/payments/stripe/handle-webhook.test.js index 8cedb56c26..dd7d60be85 100644 --- a/test/api/unit/libs/payments/stripe/handle-webhook.test.js +++ b/test/api/unit/libs/payments/stripe/handle-webhook.test.js @@ -22,7 +22,7 @@ describe('Stripe - Webhooks', () => { const eventRetrieved = {type: eventType}; beforeEach(() => { - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves(eventRetrieved); + sinon.stub(stripe.events, 'retrieve').resolves(eventRetrieved); sinon.stub(logger, 'error'); }); @@ -52,8 +52,8 @@ describe('Stripe - Webhooks', () => { const eventType = 'customer.subscription.deleted'; beforeEach(() => { - sinon.stub(stripe.customers, 'del').returnsPromise().resolves({}); - sinon.stub(payments, 'cancelSubscription').returnsPromise().resolves({}); + sinon.stub(stripe.customers, 'del').resolves({}); + sinon.stub(payments, 'cancelSubscription').resolves({}); }); afterEach(() => { @@ -62,7 +62,7 @@ describe('Stripe - Webhooks', () => { }); it('does not do anything if event.request is null (subscription cancelled manually)', async () => { - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, request: 123, @@ -79,7 +79,7 @@ describe('Stripe - Webhooks', () => { describe('user subscription', () => { it('throws an error if the user is not found', async () => { const customerId = 456; - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, data: { @@ -113,7 +113,7 @@ describe('Stripe - Webhooks', () => { subscriber.purchased.plan.paymentMethod = 'Stripe'; await subscriber.save(); - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, data: { @@ -146,7 +146,7 @@ describe('Stripe - Webhooks', () => { describe('group plan subscription', () => { it('throws an error if the group is not found', async () => { const customerId = 456; - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, data: { @@ -185,7 +185,7 @@ describe('Stripe - Webhooks', () => { subscriber.purchased.plan.paymentMethod = 'Stripe'; await subscriber.save(); - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, data: { @@ -227,7 +227,7 @@ describe('Stripe - Webhooks', () => { subscriber.purchased.plan.paymentMethod = 'Stripe'; await subscriber.save(); - sinon.stub(stripe.events, 'retrieve').returnsPromise().resolves({ + sinon.stub(stripe.events, 'retrieve').resolves({ id: 123, type: eventType, data: { diff --git a/test/api/unit/libs/payments/stripe/upgrade-group-plan.test.js b/test/api/unit/libs/payments/stripe/upgrade-group-plan.test.js index 5ef7e9a3af..38b6e6f979 100644 --- a/test/api/unit/libs/payments/stripe/upgrade-group-plan.test.js +++ b/test/api/unit/libs/payments/stripe/upgrade-group-plan.test.js @@ -38,7 +38,7 @@ describe('Stripe - Upgrade Group Plan', () => { await group.save(); spy = sinon.stub(stripe.subscriptions, 'update'); - spy.returnsPromise().resolves([]); + spy.resolves([]); data.groupId = group._id; data.sub.quantity = 3; stripePayments.setStripeApi(stripe); diff --git a/test/api/unit/models/group.test.js b/test/api/unit/models/group.test.js index 19613448af..e965ca29ff 100644 --- a/test/api/unit/models/group.test.js +++ b/test/api/unit/models/group.test.js @@ -477,7 +477,7 @@ describe('Group Model', () => { party.quest.active = false; await party.startQuest(questLeader); - Group.prototype.sendChat.reset(); + Group.prototype.sendChat.resetHistory(); await party.save(); await Group.processQuestProgress(participatingMember, progress); @@ -496,7 +496,7 @@ describe('Group Model', () => { party.quest.active = false; await party.startQuest(questLeader); - Group.prototype.sendChat.reset(); + Group.prototype.sendChat.resetHistory(); await party.save(); await Group.processQuestProgress(participatingMember, progress); diff --git a/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js b/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js index 8f306b2723..c6de3b1709 100644 --- a/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/amazon/GET-payments_amazon_subscribe_cancel.test.js @@ -23,7 +23,7 @@ describe('payments : amazon #subscribeCancel', () => { describe('success', () => { beforeEach(() => { - amazonSubscribeCancelStub = sinon.stub(amzLib, 'cancelSubscription').returnsPromise().resolves({}); + amazonSubscribeCancelStub = sinon.stub(amzLib, 'cancelSubscription').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js b/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js index 835b92e929..948c948f13 100644 --- a/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js +++ b/test/api/v3/integration/payments/amazon/POST-payments_amazon_checkout.test.js @@ -21,7 +21,7 @@ describe('payments - amazon - #checkout', () => { describe('success', () => { beforeEach(async () => { - amazonCheckoutStub = sinon.stub(amzLib, 'checkout').returnsPromise().resolves({}); + amazonCheckoutStub = sinon.stub(amzLib, 'checkout').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js b/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js index 63d0a5216b..c925579979 100644 --- a/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js +++ b/test/api/v3/integration/payments/amazon/POST-payments_amazon_subscribe.test.js @@ -27,7 +27,7 @@ describe('payments - amazon - #subscribe', () => { let coupon; beforeEach(() => { - subscribeWithAmazonStub = sinon.stub(amzLib, 'subscribe').returnsPromise().resolves({}); + subscribeWithAmazonStub = sinon.stub(amzLib, 'subscribe').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js b/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js index 56bef407ea..797d2126bb 100644 --- a/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js +++ b/test/api/v3/integration/payments/apple/GET-payments_apple_cancelSubscribe.js @@ -13,7 +13,7 @@ describe('payments : apple #cancelSubscribe', () => { let cancelStub; beforeEach(async () => { - cancelStub = sinon.stub(applePayments, 'cancelSubscribe').returnsPromise().resolves({}); + cancelStub = sinon.stub(applePayments, 'cancelSubscribe').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js b/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js index 74a1704c9e..00233f6ca8 100644 --- a/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js +++ b/test/api/v3/integration/payments/apple/POST-payments_apple_verifyiap.js @@ -13,7 +13,7 @@ describe('payments : apple #verify', () => { let verifyStub; beforeEach(async () => { - verifyStub = sinon.stub(applePayments, 'verifyGemPurchase').returnsPromise().resolves({}); + verifyStub = sinon.stub(applePayments, 'verifyGemPurchase').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js b/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js index a5b6458d16..63d76fcea0 100644 --- a/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js +++ b/test/api/v3/integration/payments/apple/POST-payments_google_subscribe.test.js @@ -21,7 +21,7 @@ describe('payments : apple #subscribe', () => { let subscribeStub; beforeEach(async () => { - subscribeStub = sinon.stub(applePayments, 'subscribe').returnsPromise().resolves({}); + subscribeStub = sinon.stub(applePayments, 'subscribe').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js b/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js index a37e15331e..ad375b89c5 100644 --- a/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js +++ b/test/api/v3/integration/payments/google/GET-payments_google_cancelSubscribe.js @@ -13,7 +13,7 @@ describe('payments : google #cancelSubscribe', () => { let cancelStub; beforeEach(async () => { - cancelStub = sinon.stub(googlePayments, 'cancelSubscribe').returnsPromise().resolves({}); + cancelStub = sinon.stub(googlePayments, 'cancelSubscribe').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js b/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js index c9418f77ce..1ee940efef 100644 --- a/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js +++ b/test/api/v3/integration/payments/google/POST-payments_google_subscribe.test.js @@ -21,7 +21,7 @@ describe('payments : google #subscribe', () => { let subscribeStub; beforeEach(async () => { - subscribeStub = sinon.stub(googlePayments, 'subscribe').returnsPromise().resolves({}); + subscribeStub = sinon.stub(googlePayments, 'subscribe').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js b/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js index 04b63f25e3..68ef509e45 100644 --- a/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js +++ b/test/api/v3/integration/payments/google/POST-payments_google_verifyiap.js @@ -13,7 +13,7 @@ describe('payments : google #verify', () => { let verifyStub; beforeEach(async () => { - verifyStub = sinon.stub(googlePayments, 'verifyGemPurchase').returnsPromise().resolves({}); + verifyStub = sinon.stub(googlePayments, 'verifyGemPurchase').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js index 804a2c4b74..ffaf8fbc8d 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout.test.js @@ -15,7 +15,7 @@ describe('payments : paypal #checkout', () => { let checkoutStub; beforeEach(async () => { - checkoutStub = sinon.stub(paypalPayments, 'checkout').returnsPromise().resolves('/'); + checkoutStub = sinon.stub(paypalPayments, 'checkout').resolves('/'); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js index 38500d72c1..9c2947c95e 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_checkout_success.test.js @@ -34,7 +34,7 @@ describe('payments : paypal #checkoutSuccess', () => { let checkoutSuccessStub; beforeEach(async () => { - checkoutSuccessStub = sinon.stub(paypalPayments, 'checkoutSuccess').returnsPromise().resolves({}); + checkoutSuccessStub = sinon.stub(paypalPayments, 'checkoutSuccess').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js index e967388bfe..156df85340 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe.test.js @@ -25,7 +25,7 @@ describe('payments : paypal #subscribe', () => { let subscribeStub; beforeEach(async () => { - subscribeStub = sinon.stub(paypalPayments, 'subscribe').returnsPromise().resolves('/'); + subscribeStub = sinon.stub(paypalPayments, 'subscribe').resolves('/'); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js index 28893f480d..4a3f416dd8 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_cancel.test.js @@ -25,7 +25,7 @@ describe('payments : paypal #subscribeCancel', () => { let subscribeCancelStub; beforeEach(async () => { - subscribeCancelStub = sinon.stub(paypalPayments, 'subscribeCancel').returnsPromise().resolves('/'); + subscribeCancelStub = sinon.stub(paypalPayments, 'subscribeCancel').resolves('/'); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js index b01ccfcd99..db0d53838f 100644 --- a/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js +++ b/test/api/v3/integration/payments/paypal/GET-payments_paypal_subscribe_success.test.js @@ -24,7 +24,7 @@ describe('payments : paypal #subscribeSuccess', () => { let subscribeSuccessStub; beforeEach(async () => { - subscribeSuccessStub = sinon.stub(paypalPayments, 'subscribeSuccess').returnsPromise().resolves({}); + subscribeSuccessStub = sinon.stub(paypalPayments, 'subscribeSuccess').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js b/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js index 6b64c62002..3e233ce9c5 100644 --- a/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js +++ b/test/api/v3/integration/payments/paypal/POST-payments_paypal_ipn.test.js @@ -20,7 +20,7 @@ describe('payments - paypal - #ipn', () => { let ipnStub; beforeEach(async () => { - ipnStub = sinon.stub(paypalPayments, 'ipn').returnsPromise().resolves({}); + ipnStub = sinon.stub(paypalPayments, 'ipn').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js b/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js index 3db4779ecb..6f074ac077 100644 --- a/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js +++ b/test/api/v3/integration/payments/stripe/GET-payments_stripe_subscribe_cancel.test.js @@ -23,7 +23,7 @@ describe('payments - stripe - #subscribeCancel', () => { describe('success', () => { beforeEach(async () => { - stripeCancelSubscriptionStub = sinon.stub(stripePayments, 'cancelSubscription').returnsPromise().resolves({}); + stripeCancelSubscriptionStub = sinon.stub(stripePayments, 'cancelSubscription').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js b/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js index d90d5fbf39..b8e4ca8631 100644 --- a/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js +++ b/test/api/v3/integration/payments/stripe/POST-payments_stripe_checkout.test.js @@ -24,7 +24,7 @@ describe('payments - stripe - #checkout', () => { let stripeCheckoutSubscriptionStub; beforeEach(async () => { - stripeCheckoutSubscriptionStub = sinon.stub(stripePayments, 'checkout').returnsPromise().resolves({}); + stripeCheckoutSubscriptionStub = sinon.stub(stripePayments, 'checkout').resolves({}); }); afterEach(() => { diff --git a/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js b/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js index dfd7b2332c..a071580ae6 100644 --- a/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js +++ b/test/api/v3/integration/payments/stripe/POST-payments_stripe_subscribe_edit.test.js @@ -25,7 +25,7 @@ describe('payments - stripe - #subscribeEdit', () => { let stripeEditSubscriptionStub; beforeEach(async () => { - stripeEditSubscriptionStub = sinon.stub(stripePayments, 'editSubscription').returnsPromise().resolves({}); + stripeEditSubscriptionStub = sinon.stub(stripePayments, 'editSubscription').resolves({}); }); afterEach(() => { diff --git a/test/helpers/globals.helper.js b/test/helpers/globals.helper.js index b34b589ed1..5dc151cb94 100644 --- a/test/helpers/globals.helper.js +++ b/test/helpers/globals.helper.js @@ -13,7 +13,7 @@ global.expect = chai.expect; global.sinon = require('sinon'); let sinonStubPromise = require('sinon-stub-promise'); sinonStubPromise(global.sinon); -global.sandbox = sinon.sandbox.create(); +global.sandbox = sinon.createSandbox(); import setupNconf from '../../website/server/libs/setupNconf'; setupNconf('./config.json.example');