mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
fix common tests
This commit is contained in:
1066
package-lock.json
generated
1066
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -35,10 +35,10 @@
|
||||
"image-size": "^0.8.0",
|
||||
"in-app-purchase": "^1.11.3",
|
||||
"js2xmlparser": "^4.0.0",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.15",
|
||||
"merge-stream": "^2.0.0",
|
||||
"method-override": "^3.0.0",
|
||||
"moment": "^2.22.1",
|
||||
"moment": "^2.24.0",
|
||||
"moment-recur": "^1.0.7",
|
||||
"mongoose": "^5.6.9",
|
||||
"morgan": "^1.7.0",
|
||||
@@ -59,12 +59,9 @@
|
||||
"superagent": "^5.0.2",
|
||||
"universal-analytics": "^0.4.17",
|
||||
"useragent": "^2.1.9",
|
||||
"uuid": "^3.0.1",
|
||||
"uuid": "^3.3.3",
|
||||
"validator": "^11.0.0",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vue": "^2.6.10",
|
||||
"vue-router": "^3.0.0",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"winston": "^2.4.3",
|
||||
"winston-loggly-bulk": "^2.0.2",
|
||||
"xml2js": "^0.4.4"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import armoireSet from '../../../website/common/script/content/gear/sets/armoire';
|
||||
import * as armoireSet from '../../../website/common/script/content/gear/sets/armoire';
|
||||
|
||||
describe('armoireSet items', () => {
|
||||
it('checks if canOwn has the same id', () => {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import {
|
||||
generateUser,
|
||||
} from '../../../helpers/common.helper';
|
||||
import count from '../../../../website/common/script/count';
|
||||
import * as count from '../../../../website/common/script/count';
|
||||
import {BuyArmoireOperation} from '../../../../website/common/script/ops/buy/buyArmoire';
|
||||
import randomVal from '../../../../website/common/script/libs/randomVal';
|
||||
import * as randomValFns from '../../../../website/common/script/libs/randomVal';
|
||||
import content from '../../../../website/common/script/content/index';
|
||||
import {
|
||||
NotAuthorized,
|
||||
@@ -51,12 +51,12 @@ describe('shared.ops.buyArmoire', () => {
|
||||
user.stats.exp = 0;
|
||||
user.items.food = {};
|
||||
|
||||
sandbox.stub(randomVal, 'trueRandom');
|
||||
sandbox.stub(randomValFns, 'trueRandom');
|
||||
sinon.stub(analytics, 'track');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
randomVal.trueRandom.restore();
|
||||
randomValFns.trueRandom.restore();
|
||||
analytics.track.restore();
|
||||
});
|
||||
|
||||
@@ -82,7 +82,7 @@ describe('shared.ops.buyArmoire', () => {
|
||||
context('non-gear awards', () => {
|
||||
it('gives Experience', () => {
|
||||
let previousExp = user.stats.exp;
|
||||
randomVal.trueRandom.returns(YIELD_EXP);
|
||||
randomValFns.trueRandom.returns(YIELD_EXP);
|
||||
|
||||
buyArmoire(user);
|
||||
|
||||
@@ -95,7 +95,7 @@ describe('shared.ops.buyArmoire', () => {
|
||||
it('gives food', () => {
|
||||
let previousExp = user.stats.exp;
|
||||
|
||||
randomVal.trueRandom.returns(YIELD_FOOD);
|
||||
randomValFns.trueRandom.returns(YIELD_FOOD);
|
||||
|
||||
buyArmoire(user);
|
||||
|
||||
@@ -106,7 +106,7 @@ describe('shared.ops.buyArmoire', () => {
|
||||
});
|
||||
|
||||
it('does not give equipment if all equipment has been found', () => {
|
||||
randomVal.trueRandom.returns(YIELD_EQUIPMENT);
|
||||
randomValFns.trueRandom.returns(YIELD_EQUIPMENT);
|
||||
user.items.gear.owned = getFullArmoire();
|
||||
user.stats.gp = 150;
|
||||
|
||||
@@ -124,7 +124,7 @@ describe('shared.ops.buyArmoire', () => {
|
||||
context('gear awards', () => {
|
||||
it('always drops equipment the first time', () => {
|
||||
delete user.flags.armoireOpened;
|
||||
randomVal.trueRandom.returns(YIELD_EXP);
|
||||
randomValFns.trueRandom.returns(YIELD_EXP);
|
||||
|
||||
expect(_.size(user.items.gear.owned)).to.equal(1);
|
||||
|
||||
@@ -141,7 +141,7 @@ describe('shared.ops.buyArmoire', () => {
|
||||
});
|
||||
|
||||
it('gives more equipment', () => {
|
||||
randomVal.trueRandom.returns(YIELD_EQUIPMENT);
|
||||
randomValFns.trueRandom.returns(YIELD_EQUIPMENT);
|
||||
user.items.gear.owned = {
|
||||
weapon_warrior_0: true,
|
||||
head_armoire_hornedIronHelm: true,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import pinnedGearUtils from '../../../../website/common/script/ops/pinnedGearUtils';
|
||||
import * as pinnedGearUtils from '../../../../website/common/script/ops/pinnedGearUtils';
|
||||
import {
|
||||
NotAuthorized,
|
||||
} from '../../../../website/common/script/libs/errors';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import purchase from '../../../../website/common/script/ops/buy/purchase';
|
||||
import pinnedGearUtils from '../../../../website/common/script/ops/pinnedGearUtils';
|
||||
import * as pinnedGearUtils from '../../../../website/common/script/ops/pinnedGearUtils';
|
||||
import {
|
||||
BadRequest,
|
||||
NotAuthorized,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import {
|
||||
import api from '../../website/common/script/index';
|
||||
|
||||
const {
|
||||
maxHealth,
|
||||
maxLevel,
|
||||
capByLevel,
|
||||
tnl,
|
||||
diminishingReturns,
|
||||
} from '../../website/common/script/index';
|
||||
} = api;
|
||||
|
||||
describe('helper functions used in stat calculations', () => {
|
||||
describe('maxHealth', () => {
|
||||
|
||||
702
website/client/package-lock.json
generated
702
website/client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,16 +19,20 @@
|
||||
"hellojs": "^1.18.1",
|
||||
"intro.js": "^2.9.3",
|
||||
"jquery": "^3.4.1",
|
||||
"lodash": "^4.17.15",
|
||||
"moment": "^2.24.0",
|
||||
"smartbanner.js": "^1.14.5",
|
||||
"svg-inline-loader": "^0.8.0",
|
||||
"svg-url-loader": "^3.0.2",
|
||||
"svgo": "^1.3.0",
|
||||
"svgo-loader": "^2.2.1",
|
||||
"uuid": "^3.3.3",
|
||||
"validator": "^11.1.0",
|
||||
"vue": "^2.6.10",
|
||||
"vue-mugen-scroll": "^0.2.6",
|
||||
"vue-router": "^3.0.6",
|
||||
"vuedraggable": "^2.23.1",
|
||||
"vuejs-datepicker": "^1.6.2"
|
||||
"vuejs-datepicker": "git://github.com/habitrpg/vuejs-datepicker.git#5d237615463a84a23dd6f3f77c6ab577d68593ec"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.0.0-rc.6",
|
||||
@@ -41,6 +45,7 @@
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"inspectpack": "^4.2.2",
|
||||
"pug": "^2.0.4",
|
||||
"pug-plain-loader": "^1.0.0",
|
||||
"sass": "^1.19.0",
|
||||
|
||||
@@ -87,7 +87,7 @@ const QuestsPage = () => import(/* webpackChunkName: "shops-quest" */'@/componen
|
||||
const SeasonalPage = () => import(/* webpackChunkName: "shops-seasonal" */'@/components/shops/seasonal/index');
|
||||
const TimeTravelersPage = () => import(/* webpackChunkName: "shops-timetravelers" */'@/components/shops/timeTravelers/index');
|
||||
|
||||
import NotFoundPage from '@/components/404';
|
||||
const NotFoundPage = () => import(/* webpackChunkName: "not-found" */'@/components/404');
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const nconf = require('nconf');
|
||||
const setupNconf = require('../../website/server/libs/setupNconf');
|
||||
const { DuplicatesPlugin } = require("inspectpack/plugin");
|
||||
|
||||
let configFile = path.join(path.resolve(__dirname, '../../config.json'));
|
||||
|
||||
@@ -37,6 +38,9 @@ envVars
|
||||
module.exports = {
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
new DuplicatesPlugin({
|
||||
verbose: true
|
||||
}),
|
||||
new webpack.EnvironmentPlugin(envObject),
|
||||
new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
|
||||
],
|
||||
|
||||
@@ -7,7 +7,7 @@ import splitWhitespace from '../../libs/splitWhitespace';
|
||||
import {
|
||||
NotAuthorized,
|
||||
} from '../../libs/errors';
|
||||
import randomVal from '../../libs/randomVal';
|
||||
import randomVal, * as randomValFns from '../../libs/randomVal';
|
||||
import {removeItemByPath} from '../pinnedGearUtils';
|
||||
import {AbstractGoldItemOperation} from './abstractBuyOperation';
|
||||
|
||||
@@ -35,7 +35,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation {
|
||||
executeChanges (user, item) {
|
||||
let result = {};
|
||||
|
||||
let armoireResult = randomVal.trueRandom();
|
||||
let armoireResult = randomValFns.trueRandom();
|
||||
let eligibleEquipment = filter(content.gear.flat, (eligible) => {
|
||||
return eligible.klass === 'armoire' && !user.items.gear.owned[eligible.key];
|
||||
});
|
||||
@@ -147,7 +147,7 @@ export class BuyArmoireOperation extends AbstractGoldItemOperation {
|
||||
}
|
||||
|
||||
_experienceResult (user) {
|
||||
let armoireExp = Math.floor(randomVal.trueRandom() * 40 + 10);
|
||||
let armoireExp = Math.floor(randomValFns.trueRandom() * 40 + 10);
|
||||
user.stats.exp += armoireExp;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user