fix tests

This commit is contained in:
Phillip Thelen
2023-02-16 09:37:00 +01:00
parent 6ee2e3a379
commit 2d5dcae406
2 changed files with 1 additions and 16 deletions

View File

@@ -215,6 +215,7 @@ describe('cron utility functions', () => {
it('monthly plan, next date in 3 months', () => {
const user = baseUserData(60, 0, 'group_plan_auto');
user.purchased.plan.perkMonthCount = 0;
const planContext = getPlanContext(user, now);

View File

@@ -117,22 +117,6 @@ async function prepareSubscriptionValues (data) {
let recipientIsSubscribed = recipient.isSubscribed();
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 (data.groupId) {
const groupFields = basicGroupFields.concat(' purchased');