mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Convert other globals to exported functions
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import armoire from '../../common/script/src/content/armoire';
|
||||
|
||||
describe('Armoire Locales', () => {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import backgroundSets from '../../common/script/src/content/backgrounds';
|
||||
import {each} from 'lodash';
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import {allEggs} from '../../common/script/src/content/eggs';
|
||||
import {each} from 'lodash';
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {questions, stillNeedHelp} from '../../common/script/src/content/faq';
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import {questions, stillNeedHelp} from '../../common/script/src/content/faq';
|
||||
|
||||
describe('FAQ Locales', () => {
|
||||
describe('Questions', () => {
|
||||
each(questions, (question, index) => {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import allFood from '../../common/script/src/content/food';
|
||||
import {each} from 'lodash';
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import {tree as allGear} from '../../common/script/src/content/gear';
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import {tree as allGear} from '../../common/script/src/content/gear';
|
||||
|
||||
describe('Gear', () => {
|
||||
each(allGear, (piece, type) => {
|
||||
describeEachItem(type, piece, (set, key) => {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import { all as potions } from '../../common/script/src/content/hatching-potions';
|
||||
import {each} from 'lodash';
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import healthPotion from '../../common/script/src/content/health-potion';
|
||||
|
||||
describe('Health Potion Locales', () => {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import {
|
||||
all as allQuests,
|
||||
byLevel as questsByLevel
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import spells from '../../common/script/src/content/spells';
|
||||
import {
|
||||
expectValidTranslationString,
|
||||
describeEachItem
|
||||
} from '../helpers/content.helper';
|
||||
import {each} from 'lodash';
|
||||
|
||||
import spells from '../../common/script/src/content/spells';
|
||||
|
||||
describe('Spells', () => {
|
||||
each(spells, (spellSet, klass) => {
|
||||
describeEachItem(klass, spellSet, (spell, key) => {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
expectValidTranslationString
|
||||
} from '../helpers/content.helper';
|
||||
|
||||
import userDefaults from '../../common/script/src/content/user-defaults';
|
||||
import {each} from 'lodash';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ i18n.translations = require('../../website/src/i18n.js').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.$/;
|
||||
|
||||
global.expectValidTranslationString = (attribute) => {
|
||||
export function expectValidTranslationString (attribute) {
|
||||
expect(attribute).to.be.a('function');
|
||||
|
||||
let translatedString = attribute();
|
||||
@@ -18,7 +18,7 @@ global.expectValidTranslationString = (attribute) => {
|
||||
expect(translatedString).to.not.match(STRING_DOES_NOT_EXIST_MSG);
|
||||
};
|
||||
|
||||
global.describeEachItem = (testDescription, set, cb, describeFunction) => {
|
||||
export function describeEachItem (testDescription, set, cb, describeFunction) {
|
||||
// describeFunction allows you to pass in 'only' or 'skip'
|
||||
// as the last argument for writing/debugging tests.
|
||||
// This should only be used with the helper functions .only and .skip below
|
||||
|
||||
Reference in New Issue
Block a user