mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
@@ -20,8 +20,9 @@ env:
|
||||
- DISABLE_REQUEST_LOGGING=true
|
||||
matrix:
|
||||
- TEST="lint"
|
||||
- TEST="test:api-v3:unit" REQUIRES_SERVER=true COVERAGE=true
|
||||
- TEST="test:api:unit" REQUIRES_SERVER=true COVERAGE=true
|
||||
- TEST="test:api-v3:integration" REQUIRES_SERVER=true COVERAGE=true
|
||||
- TEST="test:api-v4:integration" REQUIRES_SERVER=true COVERAGE=true
|
||||
- TEST="test:sanity"
|
||||
- TEST="test:content" COVERAGE=true
|
||||
- TEST="test:common" COVERAGE=true
|
||||
|
||||
@@ -165,9 +165,9 @@ gulp.task('test:content:safe', gulp.series('test:prepare:build', (cb) => {
|
||||
pipe(runner);
|
||||
}));
|
||||
|
||||
gulp.task('test:api-v3:unit', (done) => {
|
||||
gulp.task('test:api:unit', (done) => {
|
||||
let runner = exec(
|
||||
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v3-unit node_modules/mocha/bin/_mocha -- test/api/v3/unit --recursive --require ./test/helpers/start-server'),
|
||||
testBin('node_modules/.bin/istanbul cover --dir coverage/api-unit node_modules/mocha/bin/_mocha -- test/api/unit --recursive --require ./test/helpers/start-server'),
|
||||
(err) => {
|
||||
if (err) {
|
||||
process.exit(1);
|
||||
@@ -179,8 +179,8 @@ gulp.task('test:api-v3:unit', (done) => {
|
||||
pipe(runner);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:unit:watch', () => {
|
||||
return gulp.watch(['website/server/libs/*', 'test/api/v3/unit/**/*', 'website/server/controllers/**/*'], gulp.series('test:api-v3:unit', done => done()));
|
||||
gulp.task('test:api:unit:watch', () => {
|
||||
return gulp.watch(['website/server/libs/*', 'test/api/v3/unit/**/*', 'website/server/controllers/**/*'], gulp.series('test:api:unit', done => done()));
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:integration', (done) => {
|
||||
@@ -215,17 +215,43 @@ gulp.task('test:api-v3:integration:separate-server', (done) => {
|
||||
pipe(runner);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v4:integration', (done) => {
|
||||
let runner = exec(
|
||||
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v4-integration --report lcovonly node_modules/mocha/bin/_mocha -- test/api/v4 --recursive --require ./test/helpers/start-server'),
|
||||
{maxBuffer: 500 * 1024},
|
||||
(err) => {
|
||||
if (err) {
|
||||
process.exit(1);
|
||||
}
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
pipe(runner);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v4:integration:separate-server', (done) => {
|
||||
let runner = exec(
|
||||
testBin('mocha test/api/v4 --recursive --require ./test/helpers/start-server', 'LOAD_SERVER=0'),
|
||||
{maxBuffer: 500 * 1024},
|
||||
(err) => done(err)
|
||||
);
|
||||
|
||||
pipe(runner);
|
||||
});
|
||||
|
||||
gulp.task('test', gulp.series(
|
||||
'test:sanity',
|
||||
'test:content',
|
||||
'test:common',
|
||||
'test:api-v3:unit',
|
||||
'test:api:unit',
|
||||
'test:api-v3:integration',
|
||||
'test:api-v4:integration',
|
||||
done => done()
|
||||
));
|
||||
|
||||
gulp.task('test:api-v3', gulp.series(
|
||||
'test:api-v3:unit',
|
||||
'test:api:unit',
|
||||
'test:api-v3:integration',
|
||||
done => done()
|
||||
));
|
||||
));
|
||||
@@ -121,9 +121,11 @@
|
||||
"test": "npm run lint && gulp test && gulp apidoc",
|
||||
"test:build": "gulp test:prepare:build",
|
||||
"test:api-v3": "gulp test:api-v3",
|
||||
"test:api-v3:unit": "gulp test:api-v3:unit",
|
||||
"test:api:unit": "gulp test:api:unit",
|
||||
"test:api-v3:integration": "gulp test:api-v3:integration",
|
||||
"test:api-v3:integration:separate-server": "NODE_ENV=test gulp test:api-v3:integration:separate-server",
|
||||
"test:api-v4:integration": "gulp test:api-v4:integration",
|
||||
"test:api-v4:integration:separate-server": "NODE_ENV=test gulp test:api-v4:integration:separate-server",
|
||||
"test:sanity": "istanbul cover --dir coverage/sanity --report lcovonly node_modules/mocha/bin/_mocha -- test/sanity --recursive",
|
||||
"test:common": "istanbul cover --dir coverage/common --report lcovonly node_modules/mocha/bin/_mocha -- test/common --recursive",
|
||||
"test:content": "istanbul cover --dir coverage/content --report lcovonly node_modules/mocha/bin/_mocha -- test/content --recursive",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
import analyticsService from '../../../../../website/server/libs/analyticsService';
|
||||
import analyticsService from '../../../../website/server/libs/analyticsService';
|
||||
import Amplitude from 'amplitude';
|
||||
import { Visitor } from 'universal-analytics';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
import apiError from '../../../../website/server/libs/apiError';
|
||||
|
||||
describe('API Messages', () => {
|
||||
const message = 'Only public guilds support pagination.';
|
||||
@@ -1,4 +1,4 @@
|
||||
import baseModel from '../../../../../website/server/libs/baseModel';
|
||||
import baseModel from '../../../../website/server/libs/baseModel';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
describe('Base model plugin', () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import mongoose from 'mongoose';
|
||||
import {
|
||||
removeFromArray,
|
||||
} from '../../../../../website/server/libs/collectionManipulators';
|
||||
} from '../../../../website/server/libs/collectionManipulators';
|
||||
|
||||
describe('Collection Manipulators', () => {
|
||||
describe('removeFromArray', () => {
|
||||
@@ -2,15 +2,15 @@
|
||||
import moment from 'moment';
|
||||
import nconf from 'nconf';
|
||||
import requireAgain from 'require-again';
|
||||
import { recoverCron, cron } from '../../../../../website/server/libs/cron';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import common from '../../../../../website/common';
|
||||
import analytics from '../../../../../website/server/libs/analyticsService';
|
||||
import { recoverCron, cron } from '../../../../website/server/libs/cron';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
import common from '../../../../website/common';
|
||||
import analytics from '../../../../website/server/libs/analyticsService';
|
||||
|
||||
// const scoreTask = common.ops.scoreTask;
|
||||
|
||||
let pathToCronLib = '../../../../../website/server/libs/cron';
|
||||
let pathToCronLib = '../../../../website/server/libs/cron';
|
||||
|
||||
describe('cron', () => {
|
||||
let clock = null;
|
||||
@@ -3,9 +3,9 @@ import got from 'got';
|
||||
import nconf from 'nconf';
|
||||
import nodemailer from 'nodemailer';
|
||||
import requireAgain from 'require-again';
|
||||
import logger from '../../../../../website/server/libs/logger';
|
||||
import { TAVERN_ID } from '../../../../../website/server/models/group';
|
||||
import { defer } from '../../../../helpers/api-unit.helper';
|
||||
import logger from '../../../../website/server/libs/logger';
|
||||
import { TAVERN_ID } from '../../../../website/server/models/group';
|
||||
import { defer } from '../../../helpers/api-unit.helper';
|
||||
|
||||
function getUser () {
|
||||
return {
|
||||
@@ -33,7 +33,7 @@ function getUser () {
|
||||
}
|
||||
|
||||
describe('emails', () => {
|
||||
let pathToEmailLib = '../../../../../website/server/libs/email';
|
||||
let pathToEmailLib = '../../../../website/server/libs/email';
|
||||
|
||||
describe('sendEmail', () => {
|
||||
let sendMailSpy;
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
encrypt,
|
||||
decrypt,
|
||||
} from '../../../../../website/server/libs/encryption';
|
||||
} from '../../../../website/server/libs/encryption';
|
||||
|
||||
describe('encryption', () => {
|
||||
it('can encrypt and decrypt', () => {
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
BadRequest,
|
||||
InternalServerError,
|
||||
NotFound,
|
||||
} from '../../../../../website/server/libs/errors';
|
||||
} from '../../../../website/server/libs/errors';
|
||||
|
||||
describe('Custom Errors', () => {
|
||||
describe('CustomError', () => {
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
translations,
|
||||
localePath,
|
||||
langCodes,
|
||||
} from '../../../../../website/server/libs/i18n';
|
||||
} from '../../../../website/server/libs/i18n';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import winston from 'winston';
|
||||
import logger from '../../../../../website/server/libs/logger';
|
||||
import logger from '../../../../website/server/libs/logger';
|
||||
import {
|
||||
NotFound,
|
||||
} from '../../../../../website/server/libs//errors';
|
||||
} from '../../../../website/server/libs//errors';
|
||||
|
||||
describe('logger', () => {
|
||||
let logSpy;
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
import {
|
||||
encrypt,
|
||||
} from '../../../../../website/server/libs/encryption';
|
||||
} from '../../../../website/server/libs/encryption';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
} from '../../../helpers/api-integration/v3';
|
||||
import {
|
||||
sha1Encrypt as sha1EncryptPassword,
|
||||
sha1MakeSalt,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
compare,
|
||||
convertToBcrypt,
|
||||
validatePasswordResetCodeAndFindUser,
|
||||
} from '../../../../../website/server/libs/password';
|
||||
} from '../../../../website/server/libs/password';
|
||||
|
||||
describe('Password Utilities', () => {
|
||||
describe('compare', () => {
|
||||
@@ -2,11 +2,11 @@ import moment from 'moment';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import amzLib from '../../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import amzLib from '../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
import { createNonLeaderGroupMember } from '../paymentHelpers';
|
||||
|
||||
const i18n = common.i18n;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import amzLib from '../../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import amzLib from '../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -2,12 +2,12 @@ import cc from 'coupon-code';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Coupon } from '../../../../../../../website/server/models/coupon';
|
||||
import amzLib from '../../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Coupon } from '../../../../../../website/server/models/coupon';
|
||||
import amzLib from '../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -2,11 +2,11 @@ import uuid from 'uuid';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../../website/server/models/group';
|
||||
import amzLib from '../../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../website/server/models/group';
|
||||
import amzLib from '../../../../../../website/server/libs/payments/amazon';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
|
||||
describe('#upgradeGroupPlan', () => {
|
||||
let spy, data, user, group, uuidString;
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable camelcase */
|
||||
import iapModule from '../../../../../../website/server/libs/inAppPurchases';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import applePayments from '../../../../../../website/server/libs/payments/apple';
|
||||
import iap from '../../../../../../website/server/libs/inAppPurchases';
|
||||
import {model as User} from '../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../website/common';
|
||||
import iapModule from '../../../../../website/server/libs/inAppPurchases';
|
||||
import payments from '../../../../../website/server/libs/payments/payments';
|
||||
import applePayments from '../../../../../website/server/libs/payments/apple';
|
||||
import iap from '../../../../../website/server/libs/inAppPurchases';
|
||||
import {model as User} from '../../../../../website/server/models/user';
|
||||
import common from '../../../../../website/common';
|
||||
import moment from 'moment';
|
||||
|
||||
const i18n = common.i18n;
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable camelcase */
|
||||
import iapModule from '../../../../../../website/server/libs/inAppPurchases';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import googlePayments from '../../../../../../website/server/libs/payments/google';
|
||||
import iap from '../../../../../../website/server/libs/inAppPurchases';
|
||||
import {model as User} from '../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../website/common';
|
||||
import iapModule from '../../../../../website/server/libs/inAppPurchases';
|
||||
import payments from '../../../../../website/server/libs/payments/payments';
|
||||
import googlePayments from '../../../../../website/server/libs/payments/google';
|
||||
import iap from '../../../../../website/server/libs/inAppPurchases';
|
||||
import {model as User} from '../../../../../website/server/models/user';
|
||||
import common from '../../../../../website/common';
|
||||
import moment from 'moment';
|
||||
|
||||
const i18n = common.i18n;
|
||||
@@ -1,13 +1,13 @@
|
||||
import moment from 'moment';
|
||||
|
||||
import * as sender from '../../../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../../../website/server/libs/payments/payments';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../../website/server/models/group';
|
||||
import * as sender from '../../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../../website/server/libs/payments/payments';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../website/server/models/group';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import i18n from '../../../../../../../website/common/script/i18n';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import i18n from '../../../../../../website/common/script/i18n';
|
||||
|
||||
describe('Canceling a subscription for group', () => {
|
||||
let plan, group, user, data;
|
||||
@@ -2,16 +2,16 @@ import moment from 'moment';
|
||||
import stripeModule from 'stripe';
|
||||
import nconf from 'nconf';
|
||||
|
||||
import * as sender from '../../../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../../../website/server/libs/payments/payments';
|
||||
import amzLib from '../../../../../../../website/server/libs/payments/amazon';
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../../website/server/models/group';
|
||||
import * as sender from '../../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../../website/server/libs/payments/payments';
|
||||
import amzLib from '../../../../../../website/server/libs/payments/amazon';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../website/server/models/group';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
|
||||
describe('Purchasing a group plan for group', () => {
|
||||
const EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_GOOGLE = 'Google_subscription';
|
||||
@@ -1,4 +1,4 @@
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
|
||||
export async function createNonLeaderGroupMember (group) {
|
||||
let nonLeader = new User();
|
||||
@@ -1,14 +1,14 @@
|
||||
import moment from 'moment';
|
||||
|
||||
import * as sender from '../../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../../website/server/libs/payments/payments';
|
||||
import analytics from '../../../../../../website/server/libs/analyticsService';
|
||||
import notifications from '../../../../../../website/server/libs/pushNotifications';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { translate as t } from '../../../../../helpers/api-v3-integration.helper';
|
||||
import * as sender from '../../../../../website/server/libs/email';
|
||||
import * as api from '../../../../../website/server/libs/payments/payments';
|
||||
import analytics from '../../../../../website/server/libs/analyticsService';
|
||||
import notifications from '../../../../../website/server/libs/pushNotifications';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { translate as t } from '../../../../helpers/api-integration/v3';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
} from '../../../../helpers/api-unit.helper.js';
|
||||
|
||||
describe('payments/index', () => {
|
||||
let user, group, data, plan;
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable camelcase */
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
|
||||
describe('checkout success', () => {
|
||||
const subKey = 'basic_3mo';
|
||||
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable camelcase */
|
||||
import nconf from 'nconf';
|
||||
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../../website/common';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const BASE_URL = nconf.get('BASE_URL');
|
||||
const i18n = common.i18n;
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable camelcase */
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
|
||||
describe('ipn', () => {
|
||||
const subKey = 'basic_3mo';
|
||||
@@ -1,11 +1,11 @@
|
||||
/* eslint-disable camelcase */
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../website/common';
|
||||
import { createNonLeaderGroupMember } from '../paymentHelpers';
|
||||
|
||||
const i18n = common.i18n;
|
||||
@@ -1,11 +1,11 @@
|
||||
/* eslint-disable camelcase */
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
describe('subscribeSuccess', () => {
|
||||
const subKey = 'basic_3mo';
|
||||
@@ -2,9 +2,9 @@
|
||||
import moment from 'moment';
|
||||
import cc from 'coupon-code';
|
||||
|
||||
import paypalPayments from '../../../../../../../website/server/libs/payments/paypal';
|
||||
import { model as Coupon } from '../../../../../../../website/server/models/coupon';
|
||||
import common from '../../../../../../../website/common';
|
||||
import paypalPayments from '../../../../../../website/server/libs/payments/paypal';
|
||||
import { model as Coupon } from '../../../../../../website/server/models/coupon';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -2,11 +2,11 @@ import stripeModule from 'stripe';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -3,12 +3,12 @@ import cc from 'coupon-code';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Coupon } from '../../../../../../../website/server/models/coupon';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Coupon } from '../../../../../../website/server/models/coupon';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import stripeModule from 'stripe';
|
||||
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -2,10 +2,10 @@ import stripeModule from 'stripe';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import common from '../../../../../../../website/common';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
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;
|
||||
|
||||
@@ -2,12 +2,12 @@ import stripeModule from 'stripe';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../../website/common';
|
||||
import logger from '../../../../../../../website/server/libs/logger';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
import common from '../../../../../../website/common';
|
||||
import logger from '../../../../../../website/server/libs/logger';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import moment from 'moment';
|
||||
|
||||
@@ -2,11 +2,11 @@ import stripeModule from 'stripe';
|
||||
|
||||
import {
|
||||
generateGroup,
|
||||
} from '../../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../../website/server/models/group';
|
||||
import stripePayments from '../../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../../website/server/libs/payments/payments';
|
||||
} from '../../../../../helpers/api-unit.helper.js';
|
||||
import { model as User } from '../../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../../website/server/models/group';
|
||||
import stripePayments from '../../../../../../website/server/libs/payments/stripe';
|
||||
import payments from '../../../../../../website/server/libs/payments/payments';
|
||||
|
||||
describe('Stripe - Upgrade Group Plan', () => {
|
||||
const stripe = stripeModule('test');
|
||||
@@ -1,7 +1,7 @@
|
||||
import { preenHistory } from '../../../../../website/server/libs/preening';
|
||||
import { preenHistory } from '../../../../website/server/libs/preening';
|
||||
import moment from 'moment';
|
||||
import sinon from 'sinon'; // eslint-disable-line no-shadow
|
||||
import { generateHistory } from '../../../../helpers/api-unit.helper.js';
|
||||
import { generateHistory } from '../../../helpers/api-unit.helper.js';
|
||||
|
||||
describe('preenHistory', () => {
|
||||
let clock;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import requireAgain from 'require-again';
|
||||
import pushNotify from 'push-notify';
|
||||
import nconf from 'nconf';
|
||||
@@ -7,7 +7,7 @@ import gcmLib from 'node-gcm'; // works with FCM notifications too
|
||||
describe('pushNotifications', () => {
|
||||
let user;
|
||||
let sendPushNotification;
|
||||
let pathToPushNotifications = '../../../../../website/server/libs/pushNotifications';
|
||||
let pathToPushNotifications = '../../../../website/server/libs/pushNotifications';
|
||||
let fcmSendSpy;
|
||||
let apnSendSpy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import setupNconf from '../../../../../website/server/libs/setupNconf';
|
||||
import setupNconf from '../../../../website/server/libs/setupNconf';
|
||||
|
||||
import path from 'path';
|
||||
import nconf from 'nconf';
|
||||
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { IncomingWebhook } from '@slack/client';
|
||||
import requireAgain from 'require-again';
|
||||
import slack from '../../../../../website/server/libs/slack';
|
||||
import logger from '../../../../../website/server/libs/logger';
|
||||
import { TAVERN_ID } from '../../../../../website/server/models/group';
|
||||
import slack from '../../../../website/server/libs/slack';
|
||||
import logger from '../../../../website/server/libs/logger';
|
||||
import { TAVERN_ID } from '../../../../website/server/models/group';
|
||||
import nconf from 'nconf';
|
||||
import moment from 'moment';
|
||||
|
||||
@@ -112,7 +112,7 @@ describe('slack', () => {
|
||||
it('noops if no flagging url is provided', () => {
|
||||
sandbox.stub(nconf, 'get').withArgs('SLACK:FLAGGING_URL').returns('');
|
||||
sandbox.stub(logger, 'error');
|
||||
let reRequiredSlack = requireAgain('../../../../../website/server/libs/slack');
|
||||
let reRequiredSlack = requireAgain('../../../../website/server/libs/slack');
|
||||
|
||||
expect(logger.error).to.be.calledOnce;
|
||||
|
||||
@@ -3,13 +3,13 @@ import {
|
||||
getTasks,
|
||||
syncableAttrs,
|
||||
moveTask,
|
||||
} from '../../../../../website/server/libs/taskManager';
|
||||
import i18n from '../../../../../website/common/script/i18n';
|
||||
} from '../../../../website/server/libs/taskManager';
|
||||
import i18n from '../../../../website/common/script/i18n';
|
||||
import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
generateChallenge,
|
||||
} from '../../../../helpers/api-unit.helper.js';
|
||||
} from '../../../helpers/api-unit.helper.js';
|
||||
|
||||
describe('taskManager', () => {
|
||||
let user, group, challenge;
|
||||
@@ -6,14 +6,14 @@ import {
|
||||
taskActivityWebhook,
|
||||
questActivityWebhook,
|
||||
userActivityWebhook,
|
||||
} from '../../../../../website/server/libs/webhook';
|
||||
} from '../../../../website/server/libs/webhook';
|
||||
import {
|
||||
model as User,
|
||||
} from '../../../../../website/server/models/user';
|
||||
} from '../../../../website/server/models/user';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-unit.helper.js';
|
||||
import { defer } from '../../../../helpers/api-unit.helper';
|
||||
} from '../../../helpers/api-unit.helper.js';
|
||||
import { defer } from '../../../helpers/api-unit.helper';
|
||||
|
||||
describe('webhooks', () => {
|
||||
let webhooks, user;
|
||||
@@ -3,14 +3,14 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import analyticsService from '../../../../../website/server/libs/analyticsService';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import analyticsService from '../../../../website/server/libs/analyticsService';
|
||||
import nconf from 'nconf';
|
||||
import requireAgain from 'require-again';
|
||||
|
||||
describe('analytics middleware', () => {
|
||||
let res, req, next;
|
||||
let pathToAnalyticsMiddleware = '../../../../../website/server/middlewares/analytics';
|
||||
let pathToAnalyticsMiddleware = '../../../../website/server/middlewares/analytics';
|
||||
|
||||
beforeEach(() => {
|
||||
res = generateRes();
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import { authWithHeaders as authWithHeadersFactory } from '../../../../../website/server/middlewares/auth';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import { authWithHeaders as authWithHeadersFactory } from '../../../../website/server/middlewares/auth';
|
||||
|
||||
describe('auth middleware', () => {
|
||||
let res, req, user;
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import cors from '../../../../../website/server/middlewares/cors';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import cors from '../../../../website/server/middlewares/cors';
|
||||
|
||||
describe('cors middleware', () => {
|
||||
let res, req, next;
|
||||
@@ -3,14 +3,14 @@ import {
|
||||
generateReq,
|
||||
generateTodo,
|
||||
generateDaily,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import cronMiddleware from '../../../../../website/server/middlewares/cron';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import cronMiddleware from '../../../../website/server/middlewares/cron';
|
||||
import moment from 'moment';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import analyticsService from '../../../../../website/server/libs/analyticsService';
|
||||
import * as cronLib from '../../../../../website/server/libs/cron';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../website/server/models/group';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
import analyticsService from '../../../../website/server/libs/analyticsService';
|
||||
import * as cronLib from '../../../../website/server/libs/cron';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
const CRON_TIMEOUT_WAIT = new Date(60 * 60 * 1000).getTime();
|
||||
@@ -3,11 +3,11 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import i18n from '../../../../../website/common/script/i18n';
|
||||
import { ensureAdmin, ensureSudo } from '../../../../../website/server/middlewares/ensureAccessRight';
|
||||
import { NotAuthorized } from '../../../../../website/server/libs/errors';
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import i18n from '../../../../website/common/script/i18n';
|
||||
import { ensureAdmin, ensureSudo } from '../../../../website/server/middlewares/ensureAccessRight';
|
||||
import { NotAuthorized } from '../../../../website/server/libs/errors';
|
||||
import apiError from '../../../../website/server/libs/apiError';
|
||||
|
||||
describe('ensure access middlewares', () => {
|
||||
let res, req, next;
|
||||
@@ -3,9 +3,9 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import ensureDevelpmentMode from '../../../../../website/server/middlewares/ensureDevelpmentMode';
|
||||
import { NotFound } from '../../../../../website/server/libs/errors';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import ensureDevelpmentMode from '../../../../website/server/middlewares/ensureDevelpmentMode';
|
||||
import { NotFound } from '../../../../website/server/libs/errors';
|
||||
import nconf from 'nconf';
|
||||
|
||||
describe('developmentMode middleware', () => {
|
||||
@@ -2,17 +2,17 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
|
||||
import errorHandler from '../../../../../website/server/middlewares/errorHandler';
|
||||
import responseMiddleware from '../../../../../website/server/middlewares/response';
|
||||
import errorHandler from '../../../../website/server/middlewares/errorHandler';
|
||||
import responseMiddleware from '../../../../website/server/middlewares/response';
|
||||
import {
|
||||
getUserLanguage,
|
||||
attachTranslateFunction,
|
||||
} from '../../../../../website/server/middlewares/language';
|
||||
} from '../../../../website/server/middlewares/language';
|
||||
|
||||
import { BadRequest } from '../../../../../website/server/libs/errors';
|
||||
import logger from '../../../../../website/server/libs/logger';
|
||||
import { BadRequest } from '../../../../website/server/libs/errors';
|
||||
import logger from '../../../../website/server/libs/logger';
|
||||
|
||||
describe('errorHandler', () => {
|
||||
let res, req, next;
|
||||
@@ -2,13 +2,13 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import {
|
||||
getUserLanguage,
|
||||
attachTranslateFunction,
|
||||
} from '../../../../../website/server/middlewares/language';
|
||||
import common from '../../../../../website/common';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
} from '../../../../website/server/middlewares/language';
|
||||
import common from '../../../../website/common';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
@@ -2,13 +2,13 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import nconf from 'nconf';
|
||||
import requireAgain from 'require-again';
|
||||
|
||||
describe('maintenance mode middleware', () => {
|
||||
let res, req, next;
|
||||
let pathToMaintenanceModeMiddleware = '../../../../../website/server/middlewares/maintenanceMode';
|
||||
let pathToMaintenanceModeMiddleware = '../../../../website/server/middlewares/maintenanceMode';
|
||||
|
||||
beforeEach(() => {
|
||||
res = generateRes();
|
||||
@@ -2,13 +2,13 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import nconf from 'nconf';
|
||||
import requireAgain from 'require-again';
|
||||
|
||||
describe('redirects middleware', () => {
|
||||
let res, req, next;
|
||||
let pathToRedirectsMiddleware = '../../../../../website/server/middlewares/redirects';
|
||||
let pathToRedirectsMiddleware = '../../../../website/server/middlewares/redirects';
|
||||
|
||||
beforeEach(() => {
|
||||
res = generateRes();
|
||||
@@ -2,9 +2,9 @@ import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import responseMiddleware from '../../../../../website/server/middlewares/response';
|
||||
import packageInfo from '../../../../../package.json';
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import responseMiddleware from '../../../../website/server/middlewares/response';
|
||||
import packageInfo from '../../../../package.json';
|
||||
|
||||
describe('response middleware', () => {
|
||||
let res, req, next;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { model as Challenge } from '../../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import common from '../../../../../website/common/';
|
||||
import { model as Challenge } from '../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
import common from '../../../../website/common/';
|
||||
import { each, find } from 'lodash';
|
||||
|
||||
describe('Challenge Model', () => {
|
||||
@@ -1,23 +1,23 @@
|
||||
import moment from 'moment';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import validator from 'validator';
|
||||
import { sleep } from '../../../../helpers/api-unit.helper';
|
||||
import { sleep } from '../../../helpers/api-unit.helper';
|
||||
import {
|
||||
SPAM_MESSAGE_LIMIT,
|
||||
SPAM_MIN_EXEMPT_CONTRIB_LEVEL,
|
||||
SPAM_WINDOW_LENGTH,
|
||||
INVITES_LIMIT,
|
||||
model as Group,
|
||||
} from '../../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { quests as questScrolls } from '../../../../../website/common/script/content';
|
||||
} from '../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import { quests as questScrolls } from '../../../../website/common/script/content';
|
||||
import {
|
||||
groupChatReceivedWebhook,
|
||||
questActivityWebhook,
|
||||
} from '../../../../../website/server/libs/webhook';
|
||||
import * as email from '../../../../../website/server/libs/email';
|
||||
import { TAVERN_ID } from '../../../../../website/common/script/';
|
||||
import shared from '../../../../../website/common';
|
||||
} from '../../../../website/server/libs/webhook';
|
||||
import * as email from '../../../../website/server/libs/email';
|
||||
import { TAVERN_ID } from '../../../../website/common/script/';
|
||||
import shared from '../../../../website/common';
|
||||
|
||||
describe('Group Model', () => {
|
||||
let party, questLeader, participatingMember, nonParticipatingMember, undecidedMember;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { model as Challenge } from '../../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import { model as Challenge } from '../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
import { each, find, findIndex } from 'lodash';
|
||||
|
||||
describe('Group Task Methods', () => {
|
||||
@@ -1,10 +1,10 @@
|
||||
import { model as Challenge } from '../../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import { InternalServerError } from '../../../../../website/server/libs/errors';
|
||||
import { model as Challenge } from '../../../../website/server/models/challenge';
|
||||
import { model as Group } from '../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
import { InternalServerError } from '../../../../website/server/libs/errors';
|
||||
import { each } from 'lodash';
|
||||
import { generateHistory } from '../../../../helpers/api-unit.helper.js';
|
||||
import { generateHistory } from '../../../helpers/api-unit.helper.js';
|
||||
|
||||
describe('Task Model', () => {
|
||||
let guild, leader, challenge, task;
|
||||
@@ -1,7 +1,7 @@
|
||||
import moment from 'moment';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import common from '../../../../../website/common';
|
||||
import { model as User } from '../../../../website/server/models/user';
|
||||
import { model as Group } from '../../../../website/server/models/group';
|
||||
import common from '../../../../website/common';
|
||||
|
||||
describe('User Model', () => {
|
||||
it('keeps user._tmp when calling .toJSON', () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { model as UserNotification } from '../../../../../website/server/models/userNotification';
|
||||
import { model as UserNotification } from '../../../../website/server/models/userNotification';
|
||||
|
||||
describe('UserNotification Model', () => {
|
||||
context('convertNotificationsToSafeJson', () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { model as Webhook } from '../../../../../website/server/models/webhook';
|
||||
import { BadRequest } from '../../../../../website/server/libs/errors';
|
||||
import { model as Webhook } from '../../../../website/server/models/webhook';
|
||||
import { BadRequest } from '../../../../website/server/libs/errors';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
import apiError from '../../../../website/server/libs/apiError';
|
||||
|
||||
describe('Webhook Model', () => {
|
||||
context('Instance Methods', () => {
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
sleep,
|
||||
checkExistence,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('DELETE /challenges/:challengeId', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
createAndPopulateGroup,
|
||||
generateChallenge,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /challenges/:challengeId', () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
generateChallenge,
|
||||
translate as t,
|
||||
sleep,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /challenges/:challengeId/export/csv', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateGroup,
|
||||
generateChallenge,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /challenges/:challengeId/members', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateChallenge,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /challenges/:challengeId/members/:memberId', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateChallenge,
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { TAVERN_ID } from '../../../../../website/common/script/constants';
|
||||
|
||||
describe('GET challenges/groups/:groupId', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
generateChallenge,
|
||||
createAndPopulateGroup,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('GET challenges/user', () => {
|
||||
context('no official challenges', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('POST /challenges', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateChallenge,
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('POST /challenges/:challengeId/join', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateChallenge,
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('POST /challenges/:challengeId/leave', () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
sleep,
|
||||
checkExistence,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('POST /challenges/:challengeId/winner/:winnerId', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /challenges/:challengeId/clone', () => {
|
||||
it('clones a challenge', async () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateChallenge,
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('PUT /challenges/:challengeId', () => {
|
||||
let privateGuild, user, nonMember, challenge, member;
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
createAndPopulateGroup,
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('DELETE /groups/:groupId/chat/:chatId', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('GET /groups/:groupId/chat', () => {
|
||||
let user;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { find } from 'lodash';
|
||||
|
||||
describe('POST /chat/:chatId/flag', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
createAndPopulateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { find } from 'lodash';
|
||||
|
||||
describe('POST /chat/:chatId/like', () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
translate as t,
|
||||
sleep,
|
||||
server,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import {
|
||||
SPAM_MESSAGE_LIMIT,
|
||||
SPAM_MIN_EXEMPT_CONTRIB_LEVEL,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
createAndPopulateGroup,
|
||||
sleep,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /groups/:id/chat/seen', () => {
|
||||
context('Guild', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
createAndPopulateGroup,
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import config from '../../../../../config.json';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
requester,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import i18n from '../../../../../website/common/script/i18n';
|
||||
|
||||
describe('GET /content', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
resetHabiticaDB,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
|
||||
describe('GET /coupons/', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
resetHabiticaDB,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /coupons/enter/:code', () => {
|
||||
let user;
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
resetHabiticaDB,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import couponCode from 'coupon-code';
|
||||
import apiError from '../../../../../website/server/libs/apiError';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
requester,
|
||||
resetHabiticaDB,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /coupons/validate/:code', () => {
|
||||
let api = requester();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
xdescribe('GET /export/avatar-:memberId.html', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import {
|
||||
updateDocument,
|
||||
} from '../../../../helpers/mongo';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('GET /export/inbox.html', () => {
|
||||
let user;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('GET /export/userdata.json', () => {
|
||||
it('should return a valid JSON file with user data', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import xml2js from 'xml2js';
|
||||
import util from 'util';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/add-hourglass', () => {
|
||||
let userToGetHourGlass;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/add-ten-gems', () => {
|
||||
let userToGainTenGems;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/make-admin (pended for v3 prod testing)', () => {
|
||||
let user;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/modify-inventory', () => {
|
||||
let user, originalItems;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/quest-progress', () => {
|
||||
let user;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('POST /debug/set-cron', () => {
|
||||
let user;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { encrypt } from '../../../../../website/server/libs/encryption';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
|
||||
describe('GET /group-plans', () => {
|
||||
let user;
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
resetHabiticaDB,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import {
|
||||
TAVERN_ID,
|
||||
} from '../../../../../website/server/models/group';
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
} from '../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /groups/:groupId/invites', () => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user