Convert other globals to exported functions

This commit is contained in:
Blade Barringer
2015-10-03 10:48:42 -05:00
parent f9ee70e912
commit 4b46a0e9fc
12 changed files with 52 additions and 5 deletions

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import armoire from '../../common/script/src/content/armoire';
describe('Armoire Locales', () => {

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import backgroundSets from '../../common/script/src/content/backgrounds';
import {each} from 'lodash';

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import {allEggs} from '../../common/script/src/content/eggs';
import {each} from 'lodash';

View File

@@ -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) => {

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import allFood from '../../common/script/src/content/food';
import {each} from 'lodash';

View File

@@ -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) => {

View File

@@ -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';

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import healthPotion from '../../common/script/src/content/health-potion';
describe('Health Potion Locales', () => {

View File

@@ -1,4 +1,9 @@
import {
expectValidTranslationString,
describeEachItem
} from '../helpers/content.helper';
import {each} from 'lodash';
import {
all as allQuests,
byLevel as questsByLevel

View File

@@ -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) => {

View File

@@ -1,3 +1,7 @@
import {
expectValidTranslationString
} from '../helpers/content.helper';
import userDefaults from '../../common/script/src/content/user-defaults';
import {each} from 'lodash';

View File

@@ -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