mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
Fix double subscriptions, second attempt (#14345)
* fix(subscriptions): reject subs that come in too fast * fix(lint): remove unused import * fix(groups): individual subs may come rapidly * fix(subscriptions): bad paren, handle rapid testing * fix(test): reset dateUpdated between subs * fix(test): one more block for dateUpdated Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -326,9 +326,12 @@ describe('Apple Payments', () => {
|
||||
it('errors when a user is already subscribed', async () => {
|
||||
payments.createSubscription.restore();
|
||||
user = new User();
|
||||
user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
await user.save();
|
||||
|
||||
await applePayments.subscribe(sku, user, receipt, headers, nextPaymentProcessing);
|
||||
user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
await user.save();
|
||||
|
||||
await expect(applePayments.subscribe(sku, user, receipt, headers, nextPaymentProcessing))
|
||||
.to.eventually.be.rejected.and.to.eql({
|
||||
|
||||
Reference in New Issue
Block a user