diff --git a/test/api/unit/libs/payments/apple.test.js b/test/api/unit/libs/payments/apple.test.js index 95c2f20640..1e8e4f4fcc 100644 --- a/test/api/unit/libs/payments/apple.test.js +++ b/test/api/unit/libs/payments/apple.test.js @@ -94,6 +94,7 @@ describe('Apple Payments', () => { productId: 'badProduct', transactionId: token, }]); + paymentBuyGemsStub.restore(); await expect(applePayments.verifyPurchase({ user, receipt, headers })) .to.eventually.be.rejected.and.to.eql({ @@ -102,6 +103,7 @@ describe('Apple Payments', () => { message: applePayments.constants.RESPONSE_INVALID_ITEM, }); + paymentBuyGemsStub = sinon.stub(payments, 'buySkuItem').resolves({}); user.canGetGems.restore(); }); @@ -151,10 +153,10 @@ describe('Apple Payments', () => { expect(paymentBuyGemsStub).to.be.calledOnce; expect(paymentBuyGemsStub).to.be.calledWith({ user, - paymentMethod: applePayments.constants.PAYMENT_METHOD_APPLE, - gemsBlock: common.content.gems[gemTest.gemsBlock], - headers, gift: undefined, + paymentMethod: applePayments.constants.PAYMENT_METHOD_APPLE, + sku: gemTest.productId, + headers, }); expect(user.canGetGems).to.be.calledOnce; user.canGetGems.restore(); diff --git a/test/api/unit/libs/payments/google.test.js b/test/api/unit/libs/payments/google.test.js index 1108088e8d..34e3d9936f 100644 --- a/test/api/unit/libs/payments/google.test.js +++ b/test/api/unit/libs/payments/google.test.js @@ -61,6 +61,7 @@ describe('Google Payments', () => { it('should throw an error if productId is invalid', async () => { receipt = `{"token": "${token}", "productId": "invalid"}`; + paymentBuyGemsStub.restore(); await expect(googlePayments.verifyPurchase({ user, receipt, signature, headers, })) @@ -69,6 +70,7 @@ describe('Google Payments', () => { name: 'BadRequest', message: googlePayments.constants.RESPONSE_INVALID_ITEM, }); + paymentBuyGemsStub = sinon.stub(payments, 'buySkuItem').resolves({}); }); it('should throw an error if user cannot purchase gems', async () => { diff --git a/test/api/unit/libs/payments/skuItem.test.js b/test/api/unit/libs/payments/skuItem.test.js index 9e89830583..bc4bbb5c94 100644 --- a/test/api/unit/libs/payments/skuItem.test.js +++ b/test/api/unit/libs/payments/skuItem.test.js @@ -21,7 +21,7 @@ describe('payments/skuItems', () => { }); describe('#gryphatrice', () => { - const sku = 'com.habitrpg.android.habitica.iap.pets.gryphatrice-jubilant'; + const sku = 'Pet-Gryphatrice-Jubilant'; it('returns true during birthday week', () => { clock = sinon.useFakeTimers(new Date('2023-01-29')); expect(canBuySkuItem(sku, user)).to.be.true;