mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
fix test lint
This commit is contained in:
@@ -2,17 +2,18 @@ import stripeModule from 'stripe';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
} from '../../../../../helpers/api-unit.helper';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
const { i18n } = common;
|
||||
|
||||
describe('edit subscription', () => {
|
||||
const subKey = 'basic_3mo';
|
||||
const stripe = stripeModule('test');
|
||||
let user, groupId, group, token;
|
||||
let user; let groupId; let group; let
|
||||
token;
|
||||
|
||||
beforeEach(async () => {
|
||||
user = new User();
|
||||
@@ -76,7 +77,7 @@ describe('edit subscription', () => {
|
||||
});
|
||||
|
||||
it('throws an error if user is not the group leader', async () => {
|
||||
let nonLeader = new User();
|
||||
const nonLeader = new User();
|
||||
nonLeader.guilds.push(groupId);
|
||||
await nonLeader.save();
|
||||
|
||||
@@ -93,13 +94,14 @@ describe('edit subscription', () => {
|
||||
});
|
||||
|
||||
describe('success', () => {
|
||||
let stripeListSubscriptionStub, stripeUpdateSubscriptionStub, subscriptionId;
|
||||
let stripeListSubscriptionStub; let stripeUpdateSubscriptionStub; let
|
||||
subscriptionId;
|
||||
|
||||
beforeEach(() => {
|
||||
subscriptionId = 'subId';
|
||||
stripeListSubscriptionStub = sinon.stub(stripe.subscriptions, 'list')
|
||||
.resolves({
|
||||
data: [{id: subscriptionId}],
|
||||
data: [{ id: subscriptionId }],
|
||||
});
|
||||
|
||||
stripeUpdateSubscriptionStub = sinon.stub(stripe.subscriptions, 'update').resolves({});
|
||||
@@ -118,11 +120,13 @@ describe('edit subscription', () => {
|
||||
}, stripe);
|
||||
|
||||
expect(stripeListSubscriptionStub).to.be.calledOnce;
|
||||
expect(stripeListSubscriptionStub).to.be.calledWith({customer: user.purchased.plan.customerId});
|
||||
expect(stripeListSubscriptionStub).to.be.calledWith({
|
||||
customer: user.purchased.plan.customerId,
|
||||
});
|
||||
expect(stripeUpdateSubscriptionStub).to.be.calledOnce;
|
||||
expect(stripeUpdateSubscriptionStub).to.be.calledWith(
|
||||
subscriptionId,
|
||||
{ card: token }
|
||||
{ card: token },
|
||||
);
|
||||
});
|
||||
|
||||
@@ -134,11 +138,13 @@ describe('edit subscription', () => {
|
||||
}, stripe);
|
||||
|
||||
expect(stripeListSubscriptionStub).to.be.calledOnce;
|
||||
expect(stripeListSubscriptionStub).to.be.calledWith({customer: group.purchased.plan.customerId});
|
||||
expect(stripeListSubscriptionStub).to.be.calledWith({
|
||||
customer: group.purchased.plan.customerId,
|
||||
});
|
||||
expect(stripeUpdateSubscriptionStub).to.be.calledOnce;
|
||||
expect(stripeUpdateSubscriptionStub).to.be.calledWith(
|
||||
subscriptionId,
|
||||
{ card: token }
|
||||
{ card: token },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user