chore(): rename website/src -> website/server and website/public -> website/client (#7199)
2
.bowerrc
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"directory": "website/public/bower_components"
|
||||
"directory": "website/client/bower_components"
|
||||
}
|
||||
|
||||
@@ -8,18 +8,18 @@ website/transpiled-babel/
|
||||
|
||||
migrations/*
|
||||
|
||||
# The files in website/public/js should be moved out and browserified
|
||||
website/public/
|
||||
# The files in website/client/js should be moved out and browserified
|
||||
website/client/
|
||||
|
||||
# Temporarilly disabled. These should be removed when the linting errors are fixed
|
||||
common/script/content/index.js
|
||||
common/script/public/**/*.js
|
||||
|
||||
website/src/**/api-v2/**/*.js
|
||||
website/src/routes/payments.js
|
||||
website/src/routes/pages.js
|
||||
website/src/middlewares/apiThrottle.js
|
||||
website/src/middlewares/forceRefresh.js
|
||||
website/server/**/api-v2/**/*.js
|
||||
website/server/routes/payments.js
|
||||
website/server/routes/pages.js
|
||||
website/server/middlewares/apiThrottle.js
|
||||
website/server/middlewares/forceRefresh.js
|
||||
|
||||
debug-scripts/*
|
||||
scripts/*
|
||||
|
||||
12
.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
.DS_Store
|
||||
website/public/gen
|
||||
website/public/common
|
||||
website/public/apidoc
|
||||
website/client/gen
|
||||
website/client/common
|
||||
website/client/apidoc
|
||||
website/transpiled-babel/
|
||||
common/transpiled-babel/
|
||||
node_modules
|
||||
@@ -10,8 +10,8 @@ node_modules
|
||||
config.json
|
||||
npm-debug.log*
|
||||
lib
|
||||
website/public/bower_components
|
||||
website/public/new-stuff.html
|
||||
website/client/bower_components
|
||||
website/client/new-stuff.html
|
||||
website/build
|
||||
newrelic_agent.log
|
||||
.bower-tmp
|
||||
@@ -25,7 +25,7 @@ src/*/*.map
|
||||
src/*/*/*.map
|
||||
test/*.js
|
||||
test/*.map
|
||||
website/public/docs
|
||||
website/client/docs
|
||||
*.sublime-workspace
|
||||
coverage
|
||||
coverage.html
|
||||
|
||||
@@ -2,7 +2,7 @@ node_modules/**
|
||||
.bower-cache/**
|
||||
.bower-tmp/**
|
||||
.bower-registry/**
|
||||
website/public/**
|
||||
website/client/**
|
||||
website/views/**
|
||||
website/build/**
|
||||
.git/**
|
||||
|
||||
26
Gruntfile.js
@@ -43,11 +43,11 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
compress: false, // AFTER
|
||||
'include css': true,
|
||||
paths: ['website/public']
|
||||
paths: ['website/client']
|
||||
},
|
||||
files: {
|
||||
'website/build/app.css': ['website/public/css/index.styl'],
|
||||
'website/build/static.css': ['website/public/css/static.styl']
|
||||
'website/build/app.css': ['website/client/css/index.styl'],
|
||||
'website/build/static.css': ['website/client/css/static.styl']
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -55,13 +55,13 @@ module.exports = function(grunt) {
|
||||
copy: {
|
||||
build: {
|
||||
files: [
|
||||
{expand: true, cwd: 'website/public/', src: 'favicon.ico', dest: 'website/build/'},
|
||||
{expand: true, cwd: 'website/public/', src: 'favicon_192x192.png', dest: 'website/build/'},
|
||||
{expand: true, cwd: 'website/client/', src: 'favicon.ico', dest: 'website/build/'},
|
||||
{expand: true, cwd: 'website/client/', src: 'favicon_192x192.png', dest: 'website/build/'},
|
||||
{expand: true, cwd: '', src: 'common/dist/sprites/spritesmith*.png', dest: 'website/build/'},
|
||||
{expand: true, cwd: '', src: 'common/img/sprites/backer-only/*.gif', dest: 'website/build/'},
|
||||
{expand: true, cwd: '', src: 'common/img/sprites/npc_ian.gif', dest: 'website/build/'},
|
||||
{expand: true, cwd: '', src: 'common/img/sprites/quest_*.gif', dest: 'website/build/'},
|
||||
{expand: true, cwd: 'website/public/', src: 'bower_components/bootstrap/dist/fonts/*', dest: 'website/build/'}
|
||||
{expand: true, cwd: 'website/client/', src: 'bower_components/bootstrap/dist/fonts/*', dest: 'website/build/'}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -88,9 +88,9 @@ module.exports = function(grunt) {
|
||||
}
|
||||
});
|
||||
|
||||
//Load build files from public/manifest.json
|
||||
grunt.registerTask('loadManifestFiles', 'Load all build files from public/manifest.json', function(){
|
||||
var files = grunt.file.readJSON('./website/public/manifest.json');
|
||||
//Load build files from client/manifest.json
|
||||
grunt.registerTask('loadManifestFiles', 'Load all build files from client/manifest.json', function(){
|
||||
var files = grunt.file.readJSON('./website/client/manifest.json');
|
||||
var uglify = {};
|
||||
var cssmin = {};
|
||||
|
||||
@@ -101,7 +101,7 @@ module.exports = function(grunt) {
|
||||
_.each(files[key].js, function(val){
|
||||
var path = "./";
|
||||
if( val.indexOf('common/') == -1)
|
||||
path = './website/public/';
|
||||
path = './website/client/';
|
||||
js.push(path + val);
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ module.exports = function(grunt) {
|
||||
_.each(files[key].css, function(val){
|
||||
var path = "./";
|
||||
if( val.indexOf('common/') == -1) {
|
||||
path = (val == 'app.css' || val == 'static.css') ? './website/build/' : './website/public/';
|
||||
path = (val == 'app.css' || val == 'static.css') ? './website/build/' : './website/client/';
|
||||
}
|
||||
css.push(path + val)
|
||||
});
|
||||
@@ -122,7 +122,7 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.config.set('cssmin.build.files', cssmin);
|
||||
// Rewrite urls to relative path
|
||||
grunt.config.set('cssmin.build.options', {'target': 'website/public/css/whatever-css.css'});
|
||||
grunt.config.set('cssmin.build.options', {'target': 'website/client/css/whatever-css.css'});
|
||||
});
|
||||
|
||||
// Register tasks.
|
||||
@@ -131,7 +131,7 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('build:test', ['test:prepare:translations', 'build:dev']);
|
||||
|
||||
grunt.registerTask('test:prepare:translations', function() {
|
||||
var i18n = require('./website/src/libs/api-v3/i18n'),
|
||||
var i18n = require('./website/server/libs/api-v3/i18n'),
|
||||
fs = require('fs');
|
||||
fs.writeFileSync('test/spec/mocks/translations.js',
|
||||
"if(!window.env) window.env = {};\n" +
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"public/bower_components",
|
||||
"website/client/bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
|
||||
@@ -15,7 +15,7 @@ import { NotAuthorized } from '../libs/errors';
|
||||
web, this function can be performed on the client and on the server. `user` param is self (needed for determining your
|
||||
own stats for effectiveness of cast), and `target` param is one of [task, party, user]. In the case of `self` spells,
|
||||
you act on `user` instead of `target`. You can trust these are the correct objects, as long as the `target` attr of the
|
||||
spell is correct. Take a look at habitrpg/src/models/user.js and habitrpg/src/models/task.js for what attributes are
|
||||
spell is correct. Take a look at habitrpg/website/server/models/user.js and habitrpg/website/server/models/task.js for what attributes are
|
||||
available on each model. Note `task.value` is its "redness". If party is passed in, it's an array of users,
|
||||
so you'll want to iterate over them like: `_.each(target,function(member){...})`
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// TODO what can be moved to /website/src?
|
||||
// TODO what can be moved to /website/server?
|
||||
/*
|
||||
------------------------------------------------------
|
||||
Cron and time / day functions
|
||||
|
||||
@@ -11,41 +11,41 @@ module.exports = function karmaConfig (config) {
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'website/public/bower_components/jquery/dist/jquery.js',
|
||||
'website/public/bower_components/pnotify/jquery.pnotify.js',
|
||||
'website/public/bower_components/angular/angular.js',
|
||||
'website/public/bower_components/angular-loading-bar/build/loading-bar.min.js',
|
||||
'website/public/bower_components/angular-resource/angular-resource.min.js',
|
||||
'website/public/bower_components/hello/dist/hello.all.min.js',
|
||||
'website/public/bower_components/angular-sanitize/angular-sanitize.js',
|
||||
'website/public/bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'website/public/bower_components/angular-bootstrap/ui-bootstrap.js',
|
||||
'website/public/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
|
||||
'website/public/bower_components/angular-ui-router/release/angular-ui-router.js',
|
||||
'website/public/bower_components/angular-filter/dist/angular-filter.js',
|
||||
'website/public/bower_components/angular-ui/build/angular-ui.js',
|
||||
'website/public/bower_components/angular-ui-utils/ui-utils.min.js',
|
||||
'website/public/bower_components/Angular-At-Directive/src/at.js',
|
||||
'website/public/bower_components/Angular-At-Directive/src/caret.js',
|
||||
'website/public/bower_components/angular-mocks/angular-mocks.js',
|
||||
'website/public/bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js',
|
||||
'website/public/bower_components/select2/select2.js',
|
||||
'website/public/bower_components/angular-ui-select2/src/select2.js',
|
||||
'website/public/bower_components/habitica-markdown/dist/habitica-markdown.min.js',
|
||||
'website/client/bower_components/jquery/dist/jquery.js',
|
||||
'website/client/bower_components/pnotify/jquery.pnotify.js',
|
||||
'website/client/bower_components/angular/angular.js',
|
||||
'website/client/bower_components/angular-loading-bar/build/loading-bar.min.js',
|
||||
'website/client/bower_components/angular-resource/angular-resource.min.js',
|
||||
'website/client/bower_components/hello/dist/hello.all.min.js',
|
||||
'website/client/bower_components/angular-sanitize/angular-sanitize.js',
|
||||
'website/client/bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'website/client/bower_components/angular-bootstrap/ui-bootstrap.js',
|
||||
'website/client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
|
||||
'website/client/bower_components/angular-ui-router/release/angular-ui-router.js',
|
||||
'website/client/bower_components/angular-filter/dist/angular-filter.js',
|
||||
'website/client/bower_components/angular-ui/build/angular-ui.js',
|
||||
'website/client/bower_components/angular-ui-utils/ui-utils.min.js',
|
||||
'website/client/bower_components/Angular-At-Directive/src/at.js',
|
||||
'website/client/bower_components/Angular-At-Directive/src/caret.js',
|
||||
'website/client/bower_components/angular-mocks/angular-mocks.js',
|
||||
'website/client/bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js',
|
||||
'website/client/bower_components/select2/select2.js',
|
||||
'website/client/bower_components/angular-ui-select2/src/select2.js',
|
||||
'website/client/bower_components/habitica-markdown/dist/habitica-markdown.min.js',
|
||||
'common/dist/scripts/habitrpg-shared.js',
|
||||
|
||||
'test/spec/mocks/**/*.js',
|
||||
|
||||
'website/public/js/env.js',
|
||||
'website/public/js/app.js',
|
||||
'website/client/js/env.js',
|
||||
'website/client/js/app.js',
|
||||
'common/script/public/config.js',
|
||||
'common/script/public/userServices.js',
|
||||
'common/script/public/directives.js',
|
||||
|
||||
'website/public/js/services/**/*.js',
|
||||
'website/public/js/filters/**/*.js',
|
||||
'website/public/js/directives/**/*.js',
|
||||
'website/public/js/controllers/**/*.js',
|
||||
'website/client/js/services/**/*.js',
|
||||
'website/client/js/filters/**/*.js',
|
||||
'website/client/js/directives/**/*.js',
|
||||
'website/client/js/controllers/**/*.js',
|
||||
|
||||
'test/spec/specHelper.js',
|
||||
'test/spec/**/*.js',
|
||||
@@ -77,7 +77,7 @@ module.exports = function karmaConfig (config) {
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
preprocessors: {
|
||||
'website/public/js/**/*.js': ['coverage'],
|
||||
'website/client/js/**/*.js': ['coverage'],
|
||||
'test/**/*.js': ['babel'],
|
||||
},
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ var fs = require('fs');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
@@ -33,8 +33,8 @@ var MongoClient = MongoDB.MongoClient;
|
||||
mongoose.Promise = Bluebird; // otherwise mongoose models won't work
|
||||
|
||||
// Load new models
|
||||
var NewChallenge = require('../../website/src/models/challenge').model;
|
||||
var Tasks = require('../../website/src/models/task');
|
||||
var NewChallenge = require('../../website/server/models/challenge').model;
|
||||
var Tasks = require('../../website/server/models/task');
|
||||
|
||||
// To be defined later when MongoClient connects
|
||||
var mongoDbOldInstance;
|
||||
|
||||
@@ -23,7 +23,7 @@ var consoleStamp = require('console-stamp');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
|
||||
@@ -22,7 +22,7 @@ var consoleStamp = require('console-stamp');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
@@ -32,7 +32,7 @@ var MongoClient = MongoDB.MongoClient;
|
||||
mongoose.Promise = Bluebird; // otherwise mongoose models won't work
|
||||
|
||||
// Load new models
|
||||
var Coupon = require('../../website/src/models/coupon').model;
|
||||
var Coupon = require('../../website/server/models/coupon').model;
|
||||
|
||||
// To be defined later when MongoClient connects
|
||||
var mongoDbOldInstance;
|
||||
|
||||
@@ -22,7 +22,7 @@ var consoleStamp = require('console-stamp');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
@@ -32,7 +32,7 @@ var MongoClient = MongoDB.MongoClient;
|
||||
mongoose.Promise = Bluebird; // otherwise mongoose models won't work
|
||||
|
||||
// Load new models
|
||||
var EmailUnsubscription = require('../../website/src/models/emailUnsubscription').model;
|
||||
var EmailUnsubscription = require('../../website/server/models/emailUnsubscription').model;
|
||||
|
||||
// To be defined later when MongoClient connects
|
||||
var mongoDbOldInstance;
|
||||
|
||||
@@ -30,7 +30,7 @@ var consoleStamp = require('console-stamp');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
@@ -40,9 +40,9 @@ var MongoClient = MongoDB.MongoClient;
|
||||
mongoose.Promise = Bluebird; // otherwise mongoose models won't work
|
||||
|
||||
// Load new models
|
||||
var NewGroup = require('../../website/src/models/group').model;
|
||||
var NewGroup = require('../../website/server/models/group').model;
|
||||
|
||||
var TAVERN_ID = require('../../website/src/models/group').TAVERN_ID;
|
||||
var TAVERN_ID = require('../../website/server/models/group').TAVERN_ID;
|
||||
|
||||
// To be defined later when MongoClient connects
|
||||
var mongoDbOldInstance;
|
||||
|
||||
@@ -25,7 +25,7 @@ var moment = require('moment');
|
||||
consoleStamp(console);
|
||||
|
||||
// Initialize configuration
|
||||
require('../../website/src/libs/api-v3/setupNconf')();
|
||||
require('../../website/server/libs/api-v3/setupNconf')();
|
||||
|
||||
var MONGODB_OLD = nconf.get('MONGODB_OLD');
|
||||
var MONGODB_NEW = nconf.get('MONGODB_NEW');
|
||||
@@ -36,8 +36,8 @@ var MongoClient = MongoDB.MongoClient;
|
||||
mongoose.Promise = Bluebird; // otherwise mongoose models won't work
|
||||
|
||||
// Load new models
|
||||
var NewUser = require('../../website/src/models/user').model;
|
||||
var NewTasks = require('../../website/src/models/task');
|
||||
var NewUser = require('../../website/server/models/user').model;
|
||||
var NewTasks = require('../../website/server/models/task');
|
||||
|
||||
// To be defined later when MongoClient connects
|
||||
var mongoDbOldInstance;
|
||||
|
||||
@@ -7,7 +7,7 @@ nconf.argv().env().file('user', path.join(path.resolve(__dirname, '../config.jso
|
||||
|
||||
var Users = require('mongoskin').db(nconf.get("PRODUCTION_DB:URL"), nconf.get("PRODUCTION_DB").CREDS).collection('users'),
|
||||
async = require('async'),
|
||||
utils = require('../website/src/utils'),
|
||||
utils = require('../website/server/utils'),
|
||||
salt = utils.makeSalt(),
|
||||
newPassword = utils.makeSalt(), // use a salt as the new password too (they'll change it later)
|
||||
hashed_password = utils.encryptPassword(newPassword, salt);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "habitrpg",
|
||||
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
|
||||
"version": "3.0.0",
|
||||
"main": "./website/src/index.js",
|
||||
"main": "./website/server/index.js",
|
||||
"dependencies": {
|
||||
"accepts": "^1.3.2",
|
||||
"amazon-payments": "0.0.4",
|
||||
@@ -107,7 +107,7 @@
|
||||
"test:api-v3:unit": "gulp test:api-v3:unit",
|
||||
"test:api-v3:integration": "gulp test:api-v3:integration",
|
||||
"test:api-v3:integration:separate-server": "gulp test:api-v3:integration:separate-server",
|
||||
"test:api-legacy": "istanbul cover -i \"website/src/**\" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy",
|
||||
"test:api-legacy": "istanbul cover -i \"website/server/**\" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy",
|
||||
"test:common": "mocha test/common --recursive",
|
||||
"test:content": "mocha test/content --recursive",
|
||||
"test:karma": "karma start --single-run",
|
||||
|
||||
@@ -3,7 +3,7 @@ import clean from 'rimraf';
|
||||
import apidoc from 'apidoc';
|
||||
|
||||
const APIDOC_DEST_PATH = './website/build/apidoc';
|
||||
const APIDOC_SRC_PATH = './website/src';
|
||||
const APIDOC_SRC_PATH = './website/server';
|
||||
gulp.task('apidoc:clean', (done) => {
|
||||
clean(APIDOC_DEST_PATH, done);
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ gulp.task('build', () => {
|
||||
});
|
||||
|
||||
gulp.task('build:src', () => {
|
||||
return gulp.src('website/src/**/*.js')
|
||||
return gulp.src('website/server/**/*.js')
|
||||
.pipe(babel())
|
||||
.pipe(gulp.dest('website/transpiled-babel/'));
|
||||
});
|
||||
@@ -30,7 +30,7 @@ gulp.task('build:dev', ['browserify', 'prepare:staticNewStuff'], (done) => {
|
||||
});
|
||||
|
||||
gulp.task('build:dev:watch', ['build:dev'], () => {
|
||||
gulp.watch(['website/public/**/*.styl', 'common/script/*']);
|
||||
gulp.watch(['website/client/**/*.styl', 'common/script/*']);
|
||||
});
|
||||
|
||||
gulp.task('build:prod', ['browserify', 'build:server', 'prepare:staticNewStuff'], (done) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import mongoose from 'mongoose';
|
||||
import autoinc from 'mongoose-id-autoinc';
|
||||
import logger from '../website/src/libs/api-v3/logger';
|
||||
import logger from '../website/server/libs/api-v3/logger';
|
||||
import nconf from 'nconf';
|
||||
import repl from 'repl';
|
||||
import gulp from 'gulp';
|
||||
@@ -18,9 +18,9 @@ let improveRepl = (context) => {
|
||||
process.stdout.write('\u001B[2J\u001B[0;0f');
|
||||
}});
|
||||
|
||||
context.Challenge = require('../website/src/models/challenge').model;
|
||||
context.Group = require('../website/src/models/group').model;
|
||||
context.User = require('../website/src/models/user').model;
|
||||
context.Challenge = require('../website/server/models/challenge').model;
|
||||
context.Group = require('../website/server/models/group').model;
|
||||
context.User = require('../website/server/models/user').model;
|
||||
|
||||
var isProd = nconf.get('NODE_ENV') === 'production';
|
||||
var mongooseOptions = !isProd ? {} : {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {writeFileSync} from 'fs';
|
||||
|
||||
gulp.task('prepare:staticNewStuff', () => {
|
||||
writeFileSync(
|
||||
'./website/public/new-stuff.html',
|
||||
'./website/client/new-stuff.html',
|
||||
jade.compileFile('./website/views/shared/new-stuff.jade')()
|
||||
);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ gulp.task('nodemon', () => {
|
||||
nodemon({
|
||||
script: pkg.main,
|
||||
ignore: [
|
||||
'website/public/*',
|
||||
'website/client/*',
|
||||
'website/views/*',
|
||||
'common/dist/script/content/*',
|
||||
]
|
||||
|
||||
@@ -68,7 +68,7 @@ gulp.task('test:prepare:mongo', (cb) => {
|
||||
|
||||
gulp.task('test:prepare:server', ['test:prepare:mongo'], () => {
|
||||
if (!server) {
|
||||
server = exec(testBin(`node ./website/src/index.js`, `NODE_DB_URI=${TEST_DB_URI} PORT=${TEST_SERVER_PORT}`), (error, stdout, stderr) => {
|
||||
server = exec(testBin(`node ./website/server/index.js`, `NODE_DB_URI=${TEST_DB_URI} PORT=${TEST_SERVER_PORT}`), (error, stdout, stderr) => {
|
||||
if (error) { throw `Problem with the server: ${error}`; }
|
||||
if (stderr) { console.error(stderr); }
|
||||
});
|
||||
@@ -219,7 +219,7 @@ gulp.task('test:api-legacy:watch', [
|
||||
'test:prepare:mongo',
|
||||
'test:api-legacy:clean'
|
||||
], () => {
|
||||
gulp.watch(['website/src/**', 'test/api-legacy/**'], ['test:api-legacy:clean']);
|
||||
gulp.watch(['website/server/**', 'test/api-legacy/**'], ['test:api-legacy:clean']);
|
||||
});
|
||||
|
||||
gulp.task('test:karma', ['test:prepare:build'], (cb) => {
|
||||
@@ -318,7 +318,7 @@ gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
||||
|
||||
gulp.task('test:api-v2:watch', ['test:prepare:server'], () => {
|
||||
process.env.RUN_INTEGRATION_TEST_FOREVER = true;
|
||||
gulp.watch(['website/src/**', 'test/api/v2/**'], ['test:api-v2']);
|
||||
gulp.watch(['website/server/**', 'test/api/v2/**'], ['test:api-v2']);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v2:safe', ['test:prepare:server'], (done) => {
|
||||
@@ -359,7 +359,7 @@ gulp.task('test:api-v3:unit', (done) => {
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:unit:watch', () => {
|
||||
gulp.watch(['website/src/libs/api-v3/*', 'test/api/v3/unit/**/*', 'website/src/controllers/**/*'], ['test:api-v3:unit']);
|
||||
gulp.watch(['website/server/libs/api-v3/*', 'test/api/v3/unit/**/*', 'website/server/controllers/**/*'], ['test:api-v3:unit']);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:integration', (done) => {
|
||||
@@ -373,7 +373,7 @@ gulp.task('test:api-v3:integration', (done) => {
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:integration:watch', () => {
|
||||
gulp.watch(['website/src/controllers/api-v3/**/*', 'common/script/ops/*', 'website/src/libs/api-v3/*.js',
|
||||
gulp.watch(['website/server/controllers/api-v3/**/*', 'common/script/ops/*', 'website/server/libs/api-v3/*.js',
|
||||
'test/api/v3/integration/**/*'], ['test:api-v3:integration']);
|
||||
});
|
||||
|
||||
@@ -417,7 +417,7 @@ gulp.task('test:api-v3:unit', (done) => {*/
|
||||
/*});
|
||||
|
||||
gulp.task('test:api-v3:unit:watch', () => {
|
||||
gulp.watch(['website/src/**', 'test/api/v3/unit/**'], ['test:api-v3:unit']);
|
||||
gulp.watch(['website/server/**', 'test/api/v3/unit/**'], ['test:api-v3:unit']);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:integration', ['test:prepare:server'], (done) => {
|
||||
@@ -429,7 +429,7 @@ gulp.task('test:api-v3:integration', ['test:prepare:server'], (done) => {
|
||||
|
||||
gulp.task('test:api-v3:integration:watch', ['test:prepare:server'], () => {
|
||||
process.env.RUN_INTEGRATION_TEST_FOREVER = true;
|
||||
gulp.watch(['website/src/**', 'test/api/v3/integration/**'], ['test:api-v3:integration']);
|
||||
gulp.watch(['website/server/**', 'test/api/v3/integration/**'], ['test:api-v3:integration']);
|
||||
});
|
||||
|
||||
gulp.task('test:api-v3:safe', ['test:prepare:server'], (done) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ global._ = require("lodash");
|
||||
|
||||
global.shared = require("../../common");
|
||||
|
||||
global.User = require("../../website/src/models/user").model;
|
||||
global.User = require("../../website/server/models/user").model;
|
||||
|
||||
global.chai = require("chai");
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var Challenge, Group, app;
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
Group = require("../../website/src/models/group").model;
|
||||
Group = require("../../website/server/models/group").model;
|
||||
|
||||
Challenge = require("../../website/src/models/challenge").model;
|
||||
Challenge = require("../../website/server/models/challenge").model;
|
||||
|
||||
describe("Challenges", function() {
|
||||
var challenge, group, updateTodo;
|
||||
|
||||
@@ -2,9 +2,9 @@ var Group, app, diff;
|
||||
|
||||
diff = require("deep-diff");
|
||||
|
||||
Group = require("../../website/src/models/group").model;
|
||||
Group = require("../../website/server/models/group").model;
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
describe("Chat", function() {
|
||||
var chat, group;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var Coupon, app, makeSudoUser;
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
Coupon = require("../../website/src/models/coupon").model;
|
||||
Coupon = require("../../website/server/models/coupon").model;
|
||||
|
||||
makeSudoUser = function(usr, cb) {
|
||||
return registerNewUser(function() {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var app, iapMock, inApp, rewire, sinon;
|
||||
|
||||
app = require('../../website/src/server');
|
||||
app = require('../../website/server/server');
|
||||
|
||||
rewire = require('rewire');
|
||||
|
||||
sinon = require('sinon');
|
||||
|
||||
inApp = rewire('../../website/src/controllers/payments/iap');
|
||||
inApp = rewire('../../website/server/controllers/payments/iap');
|
||||
|
||||
iapMock = {};
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ var Group, app, diff;
|
||||
|
||||
diff = require("deep-diff");
|
||||
|
||||
Group = require("../../website/src/models/group").model;
|
||||
Group = require("../../website/server/models/group").model;
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
describe("Party", function() {
|
||||
return context("Quests", function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var app, rewire, sinon;
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
rewire = require('rewire');
|
||||
|
||||
@@ -21,7 +21,7 @@ describe("Push-Notifications", function() {
|
||||
});
|
||||
context("Challenges", function() {
|
||||
var challengeMock, challenges, userMock;
|
||||
challenges = rewire("../../website/src/controllers/api-v2/challenges");
|
||||
challenges = rewire("../../website/server/controllers/api-v2/challenges");
|
||||
challenges.__set__('pushNotify', pushSpy);
|
||||
challengeMock = {
|
||||
findById: function(arg, cb) {
|
||||
@@ -76,7 +76,7 @@ describe("Push-Notifications", function() {
|
||||
context("Groups", function() {
|
||||
var groups, recipient;
|
||||
recipient = null;
|
||||
groups = rewire("../../website/src/controllers/api-v2/groups");
|
||||
groups = rewire("../../website/server/controllers/api-v2/groups");
|
||||
groups.__set__('pushNotify', pushSpy);
|
||||
before(function(done) {
|
||||
return registerNewUser(function(err, _user) {
|
||||
@@ -304,7 +304,7 @@ describe("Push-Notifications", function() {
|
||||
});
|
||||
context("sending gems from balance", function() {
|
||||
var members;
|
||||
members = rewire("../../website/src/controllers/api-v2/members");
|
||||
members = rewire("../../website/server/controllers/api-v2/members");
|
||||
members.sendMessage = function() {
|
||||
return true;
|
||||
};
|
||||
@@ -342,7 +342,7 @@ describe("Push-Notifications", function() {
|
||||
});
|
||||
return describe("Purchases", function() {
|
||||
var membersMock, payments;
|
||||
payments = rewire("../../website/src/controllers/payments");
|
||||
payments = rewire("../../website/server/controllers/payments");
|
||||
payments.__set__('pushNotify', pushSpy);
|
||||
membersMock = {
|
||||
sendMessage: function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require("../../website/src/server");
|
||||
require("../../website/server/server");
|
||||
|
||||
describe("Score", function() {
|
||||
before(function(done) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var app, payments;
|
||||
|
||||
payments = require("../../website/src/controllers/payments");
|
||||
payments = require("../../website/server/controllers/payments");
|
||||
|
||||
app = require("../../website/src/server");
|
||||
app = require("../../website/server/server");
|
||||
|
||||
describe("Subscriptions", function() {
|
||||
before(function(done) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require("../../website/src/server");
|
||||
require("../../website/server/server");
|
||||
|
||||
describe("Todos", function() {
|
||||
before(function(done) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from '../../../helpers/api-integration/v2';
|
||||
import {
|
||||
TAVERN_ID,
|
||||
} from '../../../../website/src/models/group';
|
||||
} from '../../../../website/server/models/group';
|
||||
|
||||
describe('GET /groups', () => {
|
||||
const NUMBER_OF_PUBLIC_GUILDS = 3;
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
generateUser,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
import { encrypt } from '../../../../../website/src/libs/api-v3/encryption';
|
||||
import { encrypt } from '../../../../../website/server/libs/api-v3/encryption';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('GET /email/unsubscribe', () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
import {
|
||||
TAVERN_ID,
|
||||
} from '../../../../../website/src/models/group';
|
||||
} from '../../../../../website/server/models/group';
|
||||
|
||||
describe('GET /groups', () => {
|
||||
let user;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from '../../../../../helpers/api-integration/v3';
|
||||
import { v4 as generateRandomUserName } from 'uuid';
|
||||
import { each } from 'lodash';
|
||||
import { encrypt } from '../../../../../../website/src/libs/api-v3/encryption';
|
||||
import { encrypt } from '../../../../../../website/server/libs/api-v3/encryption';
|
||||
|
||||
describe('POST /user/auth/local/register', () => {
|
||||
context('username and email are free', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import analyticsService from '../../../../../website/src/libs/api-v3/analyticsService';
|
||||
import analyticsService from '../../../../../website/server/libs/api-v3/analyticsService';
|
||||
|
||||
import nock from 'nock';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import baseModel from '../../../../../website/src/libs/api-v3/baseModel';
|
||||
import baseModel from '../../../../../website/server/libs/api-v3/baseModel';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
describe('Base model plugin', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
getManifestFiles,
|
||||
} from '../../../../../website/src/libs/api-v3/buildManifest';
|
||||
} from '../../../../../website/server/libs/api-v3/buildManifest';
|
||||
|
||||
describe('Build Manifest', () => {
|
||||
describe('getManifestFiles', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import mongoose from 'mongoose';
|
||||
import {
|
||||
removeFromArray,
|
||||
} from '../../../../../website/src/libs/api-v3/collectionManipulators';
|
||||
} from '../../../../../website/server/libs/api-v3/collectionManipulators';
|
||||
|
||||
describe('Collection Manipulators', () => {
|
||||
describe('removeFromArray', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* eslint-disable global-require */
|
||||
import moment from 'moment';
|
||||
import { cron } from '../../../../../website/src/libs/api-v3/cron';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import * as Tasks from '../../../../../website/src/models/task';
|
||||
import { cron } from '../../../../../website/server/libs/api-v3/cron';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import * as Tasks from '../../../../../website/server/models/task';
|
||||
import { clone } from 'lodash';
|
||||
import common from '../../../../../common';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import nconf from 'nconf';
|
||||
import nodemailer from 'nodemailer';
|
||||
import Bluebird from 'bluebird';
|
||||
import requireAgain from 'require-again';
|
||||
import logger from '../../../../../website/src/libs/api-v3/logger';
|
||||
import logger from '../../../../../website/server/libs/api-v3/logger';
|
||||
|
||||
function defer () {
|
||||
let resolve;
|
||||
@@ -49,7 +49,7 @@ function getUser () {
|
||||
}
|
||||
|
||||
describe('emails', () => {
|
||||
let pathToEmailLib = '../../../../../website/src/libs/api-v3/email';
|
||||
let pathToEmailLib = '../../../../../website/server/libs/api-v3/email';
|
||||
|
||||
describe('sendEmail', () => {
|
||||
it('can send an email using the default transport', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
encrypt,
|
||||
decrypt,
|
||||
} from '../../../../../website/src/libs/api-v3/encryption';
|
||||
} from '../../../../../website/server/libs/api-v3/encryption';
|
||||
|
||||
describe('encryption', () => {
|
||||
it('can encrypt and decrypt', () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
BadRequest,
|
||||
InternalServerError,
|
||||
NotFound,
|
||||
} from '../../../../../website/src/libs/api-v3/errors';
|
||||
} from '../../../../../website/server/libs/api-v3/errors';
|
||||
|
||||
describe('Custom Errors', () => {
|
||||
describe('CustomError', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
translations,
|
||||
localePath,
|
||||
langCodes,
|
||||
} from '../../../../../website/src/libs/api-v3/i18n';
|
||||
} from '../../../../../website/server/libs/api-v3/i18n';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import requireAgain from 'require-again';
|
||||
|
||||
/* eslint-disable global-require */
|
||||
describe('logger', () => {
|
||||
let pathToLoggerLib = '../../../../../website/src/libs/api-v3/logger';
|
||||
let pathToLoggerLib = '../../../../../website/server/libs/api-v3/logger';
|
||||
let infoSpy;
|
||||
let errorSpy;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
encrypt as encryptPassword,
|
||||
makeSalt,
|
||||
} from '../../../../../website/src/libs/api-v3/password';
|
||||
} from '../../../../../website/server/libs/api-v3/password';
|
||||
|
||||
describe('Password Utilities', () => {
|
||||
describe('Encrypt', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as sender from '../../../../../website/src/libs/api-v3/email';
|
||||
import * as api from '../../../../../website/src/libs/api-v3/payments';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import * as sender from '../../../../../website/server/libs/api-v3/email';
|
||||
import * as api from '../../../../../website/server/libs/api-v3/payments';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('payments/index', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { preenHistory } from '../../../../../website/src/libs/api-v3/preening';
|
||||
import { preenHistory } from '../../../../../website/server/libs/api-v3/preening';
|
||||
import moment from 'moment';
|
||||
import sinon from 'sinon'; // eslint-disable-line no-shadow
|
||||
import { generateHistory } from '../../../../helpers/api-unit.helper.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import setupNconf from '../../../../../website/src/libs/api-v3/setupNconf';
|
||||
import setupNconf from '../../../../../website/server/libs/api-v3/setupNconf';
|
||||
|
||||
import path from 'path';
|
||||
import nconf from 'nconf';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import request from 'request';
|
||||
import { sendTaskWebhook } from '../../../../../website/src/libs/api-v3/webhook';
|
||||
import { sendTaskWebhook } from '../../../../../website/server/libs/api-v3/webhook';
|
||||
|
||||
describe('webhooks', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -4,13 +4,13 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import analyticsService from '../../../../../website/src/libs/api-v3/analyticsService';
|
||||
import analyticsService from '../../../../../website/server/libs/api-v3/analyticsService';
|
||||
import nconf from 'nconf';
|
||||
import requireAgain from 'require-again';
|
||||
|
||||
describe('analytics middleware', () => {
|
||||
let res, req, next;
|
||||
let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics';
|
||||
let pathToAnalyticsMiddleware = '../../../../../website/server/middlewares/api-v3/analytics';
|
||||
|
||||
beforeEach(() => {
|
||||
res = generateRes();
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import cors from '../../../../../website/src/middlewares/api-v3/cors';
|
||||
import cors from '../../../../../website/server/middlewares/api-v3/cors';
|
||||
|
||||
describe('cors middleware', () => {
|
||||
let res, req, next;
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
generateTodo,
|
||||
generateDaily,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import cronMiddleware from '../../../../../website/src/middlewares/api-v3/cron';
|
||||
import cronMiddleware from '../../../../../website/server/middlewares/api-v3/cron';
|
||||
import moment from 'moment';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import { model as Group } from '../../../../../website/src/models/group';
|
||||
import * as Tasks from '../../../../../website/src/models/task';
|
||||
import analyticsService from '../../../../../website/src/libs/api-v3/analyticsService';
|
||||
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/api-v3/analyticsService';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
|
||||
describe('cron middleware', () => {
|
||||
|
||||
@@ -5,8 +5,8 @@ import {
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import i18n from '../../../../../common/script/i18n';
|
||||
import { ensureAdmin, ensureSudo } from '../../../../../website/src/middlewares/api-v3/ensureAccessRight';
|
||||
import { NotAuthorized } from '../../../../../website/src/libs/api-v3/errors';
|
||||
import { ensureAdmin, ensureSudo } from '../../../../../website/server/middlewares/api-v3/ensureAccessRight';
|
||||
import { NotAuthorized } from '../../../../../website/server/libs/api-v3/errors';
|
||||
|
||||
describe('ensure access middlewares', () => {
|
||||
let res, req, next;
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import ensureDevelpmentMode from '../../../../../website/src/middlewares/api-v3/ensureDevelpmentMode';
|
||||
import { NotFound } from '../../../../../website/src/libs/api-v3/errors';
|
||||
import ensureDevelpmentMode from '../../../../../website/server/middlewares/api-v3/ensureDevelpmentMode';
|
||||
import { NotFound } from '../../../../../website/server/libs/api-v3/errors';
|
||||
import nconf from 'nconf';
|
||||
|
||||
describe('developmentMode middleware', () => {
|
||||
|
||||
@@ -4,15 +4,15 @@ import {
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
|
||||
import errorHandler from '../../../../../website/src/middlewares/api-v3/errorHandler';
|
||||
import responseMiddleware from '../../../../../website/src/middlewares/api-v3/response';
|
||||
import errorHandler from '../../../../../website/server/middlewares/api-v3/errorHandler';
|
||||
import responseMiddleware from '../../../../../website/server/middlewares/api-v3/response';
|
||||
import {
|
||||
getUserLanguage,
|
||||
attachTranslateFunction,
|
||||
} from '../../../../../website/src/middlewares/api-v3/language';
|
||||
} from '../../../../../website/server/middlewares/api-v3/language';
|
||||
|
||||
import { BadRequest } from '../../../../../website/src/libs/api-v3/errors';
|
||||
import logger from '../../../../../website/src/libs/api-v3/logger';
|
||||
import { BadRequest } from '../../../../../website/server/libs/api-v3/errors';
|
||||
import logger from '../../../../../website/server/libs/api-v3/logger';
|
||||
|
||||
describe('errorHandler', () => {
|
||||
let res, req, next;
|
||||
|
||||
@@ -6,10 +6,10 @@ import {
|
||||
import {
|
||||
getUserLanguage,
|
||||
attachTranslateFunction,
|
||||
} from '../../../../../website/src/middlewares/api-v3/language';
|
||||
} from '../../../../../website/server/middlewares/api-v3/language';
|
||||
import common from '../../../../../common';
|
||||
import Bluebird from 'bluebird';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
|
||||
const i18n = common.i18n;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../../helpers/api-unit.helper';
|
||||
import responseMiddleware from '../../../../../website/src/middlewares/api-v3/response';
|
||||
import responseMiddleware from '../../../../../website/server/middlewares/api-v3/response';
|
||||
|
||||
describe('response middleware', () => {
|
||||
let res, req, next;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { model as Challenge } from '../../../../../website/src/models/challenge';
|
||||
import { model as Group } from '../../../../../website/src/models/group';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import * as Tasks from '../../../../../website/src/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 common from '../../../../../common/';
|
||||
import { each, find } from 'lodash';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { sleep } from '../../../../helpers/api-unit.helper';
|
||||
import { model as Group } from '../../../../../website/src/models/group';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import { model as Group } from '../../../../../website/server/models/group';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
import { quests as questScrolls } from '../../../../../common/script/content';
|
||||
import * as email from '../../../../../website/src/libs/api-v3/email';
|
||||
import * as email from '../../../../../website/server/libs/api-v3/email';
|
||||
|
||||
describe('Group Model', () => {
|
||||
context('Instance Methods', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { model as Challenge } from '../../../../../website/src/models/challenge';
|
||||
import { model as Group } from '../../../../../website/src/models/group';
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import * as Tasks from '../../../../../website/src/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 } from 'lodash';
|
||||
import { generateHistory } from '../../../../helpers/api-unit.helper.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { model as User } from '../../../../../website/src/models/user';
|
||||
import { model as User } from '../../../../../website/server/models/user';
|
||||
|
||||
describe('User Model', () => {
|
||||
it('keeps user._tmp when calling .toJSON', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18n from '../../../common/script/i18n';
|
||||
i18n.translations = require('../../../website/src/libs/api-v3/i18n').translations;
|
||||
i18n.translations = require('../../../website/server/libs/api-v3/i18n').translations;
|
||||
|
||||
// Use this to verify error messages returned by the server
|
||||
// That way, if the translated string changes, the test
|
||||
|
||||
@@ -5,7 +5,7 @@ import Bluebird from 'bluebird';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import { ApiUser, ApiGroup, ApiChallenge } from '../api-classes';
|
||||
import { requester } from '../requester';
|
||||
import * as Tasks from '../../../../website/src/models/task';
|
||||
import * as Tasks from '../../../../website/server/models/task';
|
||||
|
||||
// Creates a new user and returns it
|
||||
// If you need the user to have specific requirements,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import '../../website/src/libs/api-v3/i18n';
|
||||
import '../../website/server/libs/api-v3/i18n';
|
||||
import mongoose from 'mongoose';
|
||||
import { defaultsDeep as defaults } from 'lodash';
|
||||
import { model as User } from '../../website/src/models/user';
|
||||
import { model as Group } from '../../website/src/models/group';
|
||||
import { model as User } from '../../website/server/models/user';
|
||||
import { model as Group } from '../../website/server/models/group';
|
||||
import mongo from './mongo'; // eslint-disable-line
|
||||
import moment from 'moment';
|
||||
import i18n from '../../common/script/i18n';
|
||||
import * as Tasks from '../../website/src/models/task';
|
||||
import * as Tasks from '../../website/server/models/task';
|
||||
|
||||
afterEach((done) => {
|
||||
sandbox.restore();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
import { wrap as wrapUser } from '../../common/script/index';
|
||||
import { model as User } from '../../website/src/models/user';
|
||||
import { model as User } from '../../website/server/models/user';
|
||||
import {
|
||||
DailySchema,
|
||||
HabitSchema,
|
||||
RewardSchema,
|
||||
TodoSchema,
|
||||
} from '../../website/src/models/task';
|
||||
} from '../../website/server/models/task';
|
||||
|
||||
export function generateUser (options = {}) {
|
||||
let user = new User(options).toObject();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require('./globals.helper');
|
||||
import i18n from '../../common/script/i18n';
|
||||
i18n.translations = require('../../website/src/libs/api-v3/i18n').translations;
|
||||
i18n.translations = require('../../website/server/libs/api-v3/i18n').translations;
|
||||
|
||||
export const STRING_ERROR_MSG = 'Error processing the string. Please see Help > Report a Bug.';
|
||||
export const STRING_DOES_NOT_EXIST_MSG = /^String '.*' not found.$/;
|
||||
|
||||
@@ -23,17 +23,17 @@ import mongoose from 'mongoose';
|
||||
// Load nconf for unit tests
|
||||
//------------------------------
|
||||
if (process.env.LOAD_SERVER === '0') { // when the server is in a different process we simply connect to mongoose
|
||||
require('../../website/src/libs/api-v3/setupNconf')('./config.json');
|
||||
require('../../website/server/libs/api-v3/setupNconf')('./config.json');
|
||||
// Use Q promises instead of mpromise in mongoose
|
||||
mongoose.Promise = Bluebird;
|
||||
mongoose.connect(nconf.get('NODE_DB_URI'));
|
||||
} else { // When running tests and the server in the same process
|
||||
require('../../website/src/libs/api-v3/setupNconf')('./config.json.example');
|
||||
require('../../website/server/libs/api-v3/setupNconf')('./config.json.example');
|
||||
nconf.set('NODE_DB_URI', 'mongodb://localhost/habitrpg_test');
|
||||
nconf.set('NODE_ENV', 'test');
|
||||
nconf.set('IS_TEST', true);
|
||||
// We require src/server and npt src/index because
|
||||
// 1. nconf is already setup
|
||||
// 2. we don't need clustering
|
||||
require('../../website/src/server');
|
||||
require('../../website/server/server');
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import mongoose from 'mongoose';
|
||||
import { TAVERN_ID } from '../../website/src/models/group';
|
||||
import { TAVERN_ID } from '../../website/server/models/group';
|
||||
|
||||
// Useful for checking things that have been deleted,
|
||||
// but you no longer have access to,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
TEST_DB = process.env.DB_NAME = 'habitrpg_migration_test'
|
||||
process.env.NODE_DB_URI = 'mongodb://localhost/' + TEST_DB
|
||||
|
||||
app = require('../../website/src/server')
|
||||
app = require('../../website/server/server')
|
||||
sh = require('shelljs')
|
||||
|
||||
runMigration = ->
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('analytics', function() {
|
||||
});
|
||||
|
||||
describe('init', function() {
|
||||
var analytics = rewire('../../website/src/libs/api-v2/analytics');
|
||||
var analytics = rewire('../../website/server/libs/api-v2/analytics');
|
||||
|
||||
it('throws an error if no options are passed in', function() {
|
||||
expect(analytics).to.throw('No options provided');
|
||||
@@ -62,7 +62,7 @@ describe('analytics', function() {
|
||||
describe('track', function() {
|
||||
|
||||
var analyticsData, event_type;
|
||||
var analytics = rewire('../../website/src/libs/api-v2/analytics');
|
||||
var analytics = rewire('../../website/server/libs/api-v2/analytics');
|
||||
var initializedAnalytics;
|
||||
|
||||
beforeEach(function() {
|
||||
@@ -370,7 +370,7 @@ describe('analytics', function() {
|
||||
|
||||
var purchaseData;
|
||||
|
||||
var analytics = rewire('../../website/src/libs/api-v2/analytics');
|
||||
var analytics = rewire('../../website/server/libs/api-v2/analytics');
|
||||
var initializedAnalytics;
|
||||
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -4,11 +4,11 @@ chai.use(require("sinon-chai"));
|
||||
var expect = chai.expect;
|
||||
|
||||
var Bluebird = require('bluebird');
|
||||
var Group = require('../../../website/src/models/group').model;
|
||||
var groupsController = require('../../../website/src/controllers/api-v2/groups');
|
||||
var Group = require('../../../website/server/models/group').model;
|
||||
var groupsController = require('../../../website/server/controllers/api-v2/groups');
|
||||
|
||||
describe('Groups Controller', function() {
|
||||
var utils = require('../../../website/src/libs/api-v2/utils');
|
||||
var utils = require('../../../website/server/libs/api-v2/utils');
|
||||
|
||||
describe('#invite', function() {
|
||||
var res, req, user, group;
|
||||
@@ -69,7 +69,7 @@ describe('Groups Controller', function() {
|
||||
});
|
||||
|
||||
context('emails', function() {
|
||||
var EmailUnsubscription = require('../../../website/src/models/emailUnsubscription').model;
|
||||
var EmailUnsubscription = require('../../../website/server/models/emailUnsubscription').model;
|
||||
var execStub, selectStub;
|
||||
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -4,7 +4,7 @@ chai.use(require("sinon-chai"))
|
||||
var expect = chai.expect
|
||||
var rewire = require('rewire');
|
||||
|
||||
var userController = rewire('../../../website/src/controllers/api-v2/user');
|
||||
var userController = rewire('../../../website/server/controllers/api-v2/user');
|
||||
|
||||
describe('User Controller', function() {
|
||||
|
||||
@@ -359,7 +359,7 @@ describe('User Controller', function() {
|
||||
});
|
||||
|
||||
it('sends webhooks', function() {
|
||||
var webhook = require('../../../website/src/libs/webhook');
|
||||
var webhook = require('../../../website/server/libs/webhook');
|
||||
sinon.spy(webhook, 'sendTaskWebhook');
|
||||
|
||||
userController.score(req, res);
|
||||
@@ -384,7 +384,7 @@ describe('User Controller', function() {
|
||||
});
|
||||
|
||||
context('save callback dealing with non challenge tasks', function() {
|
||||
var Challenge = require('../../../website/src/models/challenge').model;
|
||||
var Challenge = require('../../../website/server/models/challenge').model;
|
||||
|
||||
beforeEach(function() {
|
||||
user.save.yields(null, user);
|
||||
@@ -446,7 +446,7 @@ describe('User Controller', function() {
|
||||
});
|
||||
|
||||
context('save callback dealing with challenge tasks', function() {
|
||||
var Challenge = require('../../../website/src/models/challenge').model;
|
||||
var Challenge = require('../../../website/server/models/challenge').model;
|
||||
var chal;
|
||||
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -4,7 +4,7 @@ chai.use(require("sinon-chai"))
|
||||
var expect = chai.expect
|
||||
var rewire = require('rewire');
|
||||
|
||||
var webhook = rewire('../../website/src/libs/api-v2/webhook');
|
||||
var webhook = rewire('../../website/server/libs/api-v2/webhook');
|
||||
|
||||
describe('webhooks', function() {
|
||||
var postSpy;
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |