fix test lint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 20:45:38 +02:00
parent e37f4467f8
commit 85fb5f33aa
367 changed files with 6635 additions and 6080 deletions

View File

@@ -6,8 +6,9 @@ import {
import amzLib from '../../../../../../website/server/libs/payments/amazon';
describe('payments : amazon #subscribeCancel', () => {
let endpoint = '/amazon/subscribe/cancel?noRedirect=true';
let user, group, amazonSubscribeCancelStub;
const endpoint = '/amazon/subscribe/cancel?noRedirect=true';
let user; let group; let
amazonSubscribeCancelStub;
beforeEach(async () => {
user = await generateUser();

View File

@@ -4,8 +4,9 @@ import {
import amzLib from '../../../../../../website/server/libs/payments/amazon';
describe('payments - amazon - #checkout', () => {
let endpoint = '/amazon/checkout';
let user, amazonCheckoutStub;
const endpoint = '/amazon/checkout';
let user; let
amazonCheckoutStub;
beforeEach(async () => {
user = await generateUser();
@@ -37,7 +38,7 @@ describe('payments - amazon - #checkout', () => {
balance: 2,
});
let gift = {
const gift = {
type: 'gems',
gems: {
amount: 16,
@@ -45,7 +46,7 @@ describe('payments - amazon - #checkout', () => {
},
};
let orderReferenceId = 'orderReferenceId-example';
const orderReferenceId = 'orderReferenceId-example';
await user.post(endpoint, {
gift,

View File

@@ -3,7 +3,7 @@ import {
} from '../../../../../helpers/api-integration/v3';
describe('payments - amazon - #createOrderReferenceId', () => {
let endpoint = '/amazon/createOrderReferenceId';
const endpoint = '/amazon/createOrderReferenceId';
let user;
beforeEach(async () => {

View File

@@ -6,8 +6,9 @@ import {
import amzLib from '../../../../../../website/server/libs/payments/amazon';
describe('payments - amazon - #subscribe', () => {
let endpoint = '/amazon/subscribe';
let user, group, subscribeWithAmazonStub;
const endpoint = '/amazon/subscribe';
let user; let group; let
subscribeWithAmazonStub;
beforeEach(async () => {
user = await generateUser();
@@ -22,8 +23,8 @@ describe('payments - amazon - #subscribe', () => {
});
describe('success', () => {
let billingAgreementId = 'billingAgreementId-example';
let subscription = 'basic_3mo';
const billingAgreementId = 'billingAgreementId-example';
const subscription = 'basic_3mo';
let coupon;
beforeEach(() => {

View File

@@ -3,7 +3,7 @@ import {
} from '../../../../../helpers/api-integration/v3';
describe('payments : amazon', () => {
let endpoint = '/amazon/verifyAccessToken';
const endpoint = '/amazon/verifyAccessToken';
let user;
beforeEach(async () => {

View File

@@ -1,8 +1,8 @@
import {generateUser} from '../../../../../helpers/api-integration/v3';
import { generateUser } from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/payments/apple';
describe('payments : apple #cancelSubscribe', () => {
let endpoint = '/iap/ios/subscribe/cancel?noRedirect=true';
const endpoint = '/iap/ios/subscribe/cancel?noRedirect=true';
let user;
beforeEach(async () => {

View File

@@ -1,9 +1,9 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/payments/apple';
describe('payments : apple #norenewsubscribe', () => {
let endpoint = '/iap/ios/norenew-subscribe';
let sku = 'com.habitrpg.ios.habitica.subscription.3month';
const endpoint = '/iap/ios/norenew-subscribe';
const sku = 'com.habitrpg.ios.habitica.subscription.3month';
let user;
beforeEach(async () => {
@@ -50,7 +50,7 @@ describe('payments : apple #norenewsubscribe', () => {
await user.post(endpoint, {
sku,
transaction: {receipt: 'receipt'},
transaction: { receipt: 'receipt' },
gift: {
uuid: '1',
},

View File

@@ -1,8 +1,8 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/payments/apple';
describe('payments : apple #subscribe', () => {
let endpoint = '/iap/ios/subscribe';
const endpoint = '/iap/ios/subscribe';
let user;
beforeEach(async () => {
@@ -37,7 +37,7 @@ describe('payments : apple #subscribe', () => {
balance: 2,
});
let sku = 'com.habitrpg.ios.habitica.subscription.3month';
const sku = 'com.habitrpg.ios.habitica.subscription.3month';
await user.post(endpoint, {
sku,

View File

@@ -1,8 +1,8 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/payments/apple';
describe('payments : apple #verify', () => {
let endpoint = '/iap/ios/verify';
const endpoint = '/iap/ios/verify';
let user;
beforeEach(async () => {
@@ -36,7 +36,8 @@ describe('payments : apple #verify', () => {
await user.post(endpoint, {
transaction: {
receipt: 'receipt',
}});
},
});
expect(verifyStub).to.be.calledOnce;
expect(verifyStub.args[0][0].user._id).to.eql(user._id);
@@ -56,7 +57,8 @@ describe('payments : apple #verify', () => {
},
gift: {
uuid: '1',
}});
},
});
expect(verifyStub).to.be.calledOnce;
expect(verifyStub.args[0][0].user._id).to.eql(user._id);

View File

@@ -1,8 +1,8 @@
import {generateUser} from '../../../../../helpers/api-integration/v3';
import { generateUser } from '../../../../../helpers/api-integration/v3';
import googlePayments from '../../../../../../website/server/libs/payments/google';
describe('payments : google #cancelSubscribe', () => {
let endpoint = '/iap/android/subscribe/cancel?noRedirect=true';
const endpoint = '/iap/android/subscribe/cancel?noRedirect=true';
let user;
beforeEach(async () => {

View File

@@ -1,9 +1,9 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import googlePayments from '../../../../../../website/server/libs/payments/google';
describe('payments : google #norenewsubscribe', () => {
let endpoint = '/iap/android/norenew-subscribe';
let sku = 'com.habitrpg.android.habitica.subscription.3month';
const endpoint = '/iap/android/norenew-subscribe';
const sku = 'com.habitrpg.android.habitica.subscription.3month';
let user;
beforeEach(async () => {

View File

@@ -1,8 +1,8 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import googlePayments from '../../../../../../website/server/libs/payments/google';
describe('payments : google #subscribe', () => {
let endpoint = '/iap/android/subscribe';
const endpoint = '/iap/android/subscribe';
let user;
beforeEach(async () => {
@@ -37,11 +37,11 @@ describe('payments : google #subscribe', () => {
balance: 2,
});
let sku = 'com.habitrpg.android.habitica.subscription.3month';
const sku = 'com.habitrpg.android.habitica.subscription.3month';
await user.post(endpoint, {
sku,
transaction: {receipt: 'receipt', signature: 'signature'},
transaction: { receipt: 'receipt', signature: 'signature' },
});
expect(subscribeStub).to.be.calledOnce;

View File

@@ -1,8 +1,8 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import { generateUser, translate as t } from '../../../../../helpers/api-integration/v3';
import googlePayments from '../../../../../../website/server/libs/payments/google';
describe('payments : google #verify', () => {
let endpoint = '/iap/android/verify';
const endpoint = '/iap/android/verify';
let user;
beforeEach(async () => {
@@ -34,7 +34,7 @@ describe('payments : google #verify', () => {
});
await user.post(endpoint, {
transaction: {receipt: 'receipt', signature: 'signature'},
transaction: { receipt: 'receipt', signature: 'signature' },
});
expect(verifyStub).to.be.calledOnce;
@@ -51,8 +51,8 @@ describe('payments : google #verify', () => {
});
await user.post(endpoint, {
transaction: {receipt: 'receipt', signature: 'signature'},
gift: {uuid: '1'},
transaction: { receipt: 'receipt', signature: 'signature' },
gift: { uuid: '1' },
});
expect(verifyStub).to.be.calledOnce;

View File

@@ -4,7 +4,7 @@ import {
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
describe('payments : paypal #checkout', () => {
let endpoint = '/paypal/checkout';
const endpoint = '/paypal/checkout';
let user;
beforeEach(async () => {

View File

@@ -5,7 +5,7 @@ import paypalPayments from '../../../../../../website/server/libs/payments/paypa
import apiError from '../../../../../../website/server/libs/apiError';
describe('payments : paypal #checkoutSuccess', () => {
let endpoint = '/paypal/checkout/success';
const endpoint = '/paypal/checkout/success';
let user;
beforeEach(async () => {
@@ -42,8 +42,8 @@ describe('payments : paypal #checkoutSuccess', () => {
});
it('makes a purchase', async () => {
let paymentId = 'test-paymentid';
let customerId = 'test-customerId';
const paymentId = 'test-paymentid';
const customerId = 'test-customerId';
user = await generateUser({
'profile.name': 'sender',

View File

@@ -6,7 +6,7 @@ import shared from '../../../../../../website/common';
import apiError from '../../../../../../website/server/libs/apiError';
describe('payments : paypal #subscribe', () => {
let endpoint = '/paypal/subscribe';
const endpoint = '/paypal/subscribe';
let user;
beforeEach(async () => {
@@ -33,8 +33,8 @@ describe('payments : paypal #subscribe', () => {
});
it('makes a purchase', async () => {
let subKey = 'basic_3mo';
let sub = shared.content.subscriptionBlocks[subKey];
const subKey = 'basic_3mo';
const sub = shared.content.subscriptionBlocks[subKey];
user = await generateUser({
'profile.name': 'sender',

View File

@@ -5,7 +5,7 @@ import {
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
describe('payments : paypal #subscribeCancel', () => {
let endpoint = '/paypal/subscribe/cancel';
const endpoint = '/paypal/subscribe/cancel';
let user;
beforeEach(async () => {

View File

@@ -5,7 +5,7 @@ import apiError from '../../../../../../website/server/libs/apiError';
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
describe('payments : paypal #subscribeSuccess', () => {
let endpoint = '/paypal/subscribe/success';
const endpoint = '/paypal/subscribe/success';
let user;
beforeEach(async () => {
@@ -32,7 +32,7 @@ describe('payments : paypal #subscribeSuccess', () => {
});
it('creates a subscription', async () => {
let token = 'test-token';
const token = 'test-token';
user = await generateUser({
'profile.name': 'sender',

View File

@@ -4,7 +4,7 @@ import {
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
describe('payments - paypal - #ipn', () => {
let endpoint = '/paypal/ipn';
const endpoint = '/paypal/ipn';
let user;
beforeEach(async () => {
@@ -12,7 +12,7 @@ describe('payments - paypal - #ipn', () => {
});
it('verifies credentials', async () => {
let result = await user.post(endpoint);
const result = await user.post(endpoint);
expect(result).to.eql('OK');
});

View File

@@ -6,8 +6,9 @@ import {
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
describe('payments - stripe - #subscribeCancel', () => {
let endpoint = '/stripe/subscribe/cancel?noRedirect=true';
let user, group, stripeCancelSubscriptionStub;
const endpoint = '/stripe/subscribe/cancel?noRedirect=true';
let user; let group; let
stripeCancelSubscriptionStub;
beforeEach(async () => {
user = await generateUser();

View File

@@ -5,15 +5,16 @@ import {
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
describe('payments - stripe - #checkout', () => {
let endpoint = '/stripe/checkout';
let user, group;
const endpoint = '/stripe/checkout';
let user; let
group;
beforeEach(async () => {
user = await generateUser();
});
it('verifies credentials', async () => {
await expect(user.post(endpoint, {id: 123})).to.eventually.be.rejected.and.include({
await expect(user.post(endpoint, { id: 123 })).to.eventually.be.rejected.and.include({
code: 401,
error: 'Error',
message: 'Invalid API Key provided: aaaabbbb********************1111',

View File

@@ -6,8 +6,9 @@ import {
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
describe('payments - stripe - #subscribeEdit', () => {
let endpoint = '/stripe/subscribe/edit';
let user, group;
const endpoint = '/stripe/subscribe/edit';
let user; let
group;
beforeEach(async () => {
user = await generateUser();