mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
fix tests
This commit is contained in:
@@ -215,6 +215,7 @@ describe('cron utility functions', () => {
|
|||||||
|
|
||||||
it('monthly plan, next date in 3 months', () => {
|
it('monthly plan, next date in 3 months', () => {
|
||||||
const user = baseUserData(60, 0, 'group_plan_auto');
|
const user = baseUserData(60, 0, 'group_plan_auto');
|
||||||
|
user.purchased.plan.perkMonthCount = 0;
|
||||||
|
|
||||||
const planContext = getPlanContext(user, now);
|
const planContext = getPlanContext(user, now);
|
||||||
|
|
||||||
|
|||||||
@@ -117,22 +117,6 @@ async function prepareSubscriptionValues (data) {
|
|||||||
let recipientIsSubscribed = recipient.isSubscribed();
|
let recipientIsSubscribed = recipient.isSubscribed();
|
||||||
const isNewSubscription = !recipientIsSubscribed;
|
const isNewSubscription = !recipientIsSubscribed;
|
||||||
|
|
||||||
if (data.user && !data.gift && !data.groupId) {
|
|
||||||
const unlockedUser = await User.findOneAndUpdate(
|
|
||||||
{
|
|
||||||
_id: data.user._id,
|
|
||||||
$or: [
|
|
||||||
{ _subSignature: 'NOT_RUNNING' },
|
|
||||||
{ _subSignature: { $exists: false } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{ $set: { _subSignature: 'SUB_IN_PROGRESS' } },
|
|
||||||
);
|
|
||||||
if (!unlockedUser) {
|
|
||||||
throw new NotFound('User not found or subscription already processing.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we are buying a group subscription
|
// If we are buying a group subscription
|
||||||
if (data.groupId) {
|
if (data.groupId) {
|
||||||
const groupFields = basicGroupFields.concat(' purchased');
|
const groupFields = basicGroupFields.concat(' purchased');
|
||||||
|
|||||||
Reference in New Issue
Block a user