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