mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Merge branch 'release' into develop
This commit is contained in:
@@ -417,6 +417,7 @@ describe('Apple Payments', () => {
|
||||
|
||||
it('errors when a user is using the same subscription', async () => {
|
||||
user = new User();
|
||||
user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
await user.save();
|
||||
payments.createSubscription.restore();
|
||||
|
||||
@@ -430,6 +431,8 @@ describe('Apple Payments', () => {
|
||||
}]);
|
||||
|
||||
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({
|
||||
|
||||
@@ -370,6 +370,10 @@ describe('payments/index', () => {
|
||||
});
|
||||
|
||||
context('Purchasing a subscription for self', () => {
|
||||
beforeEach(() => {
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
});
|
||||
|
||||
it('creates a subscription', async () => {
|
||||
expect(user.purchased.plan.planId).to.not.exist;
|
||||
|
||||
@@ -396,6 +400,7 @@ describe('payments/index', () => {
|
||||
user.purchased.plan = plan;
|
||||
user.purchased.plan.dateTerminated = moment(new Date()).add(2, 'months');
|
||||
expect(user.purchased.plan.extraMonths).to.eql(0);
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
|
||||
await api.createSubscription(data);
|
||||
|
||||
@@ -406,6 +411,7 @@ describe('payments/index', () => {
|
||||
user.purchased.plan = plan;
|
||||
user.purchased.plan.dateTerminated = moment(new Date()).subtract(2, 'months');
|
||||
expect(user.purchased.plan.extraMonths).to.eql(0);
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
|
||||
await api.createSubscription(data);
|
||||
|
||||
@@ -415,6 +421,7 @@ describe('payments/index', () => {
|
||||
it('does not reset Gold-to-Gems cap on additional subscription', async () => {
|
||||
user.purchased.plan = plan;
|
||||
user.purchased.plan.gemsBought = 10;
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
|
||||
await api.createSubscription(data);
|
||||
|
||||
@@ -551,6 +558,10 @@ describe('payments/index', () => {
|
||||
});
|
||||
|
||||
context('Block subscription perks', () => {
|
||||
beforeEach(() => {
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
});
|
||||
|
||||
it('adds block months to plan.consecutive.offset', async () => {
|
||||
await api.createSubscription(data);
|
||||
|
||||
@@ -587,6 +598,7 @@ describe('payments/index', () => {
|
||||
data.sub.key = 'basic_12mo';
|
||||
|
||||
await api.createSubscription(data);
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
await api.createSubscription(data);
|
||||
|
||||
expect(user.purchased.plan.consecutive.gemCapExtra).to.eql(25);
|
||||
@@ -753,6 +765,7 @@ describe('payments/index', () => {
|
||||
now: mayMysteryItemTimeframe,
|
||||
toFake: ['Date'],
|
||||
});
|
||||
data.user.purchased.plan.dateUpdated = moment().subtract(1, 'hours').toDate();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user