From 4b46a0e9fcb874a1f5ee98e5a06f2f33a9fc2f56 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sat, 3 Oct 2015 10:48:42 -0500 Subject: [PATCH] Convert other globals to exported functions --- test/content/armoire.js | 4 ++++ test/content/backgrounds.js | 4 ++++ test/content/eggs.js | 4 ++++ test/content/faq.js | 6 +++++- test/content/food.js | 4 ++++ test/content/gear.js | 7 ++++++- test/content/hatching-potions.js | 4 ++++ test/content/health-potion.js | 4 ++++ test/content/quests.js | 5 +++++ test/content/spells.js | 7 ++++++- test/content/user-defaults.js | 4 ++++ test/helpers/content.helper.js | 4 ++-- 12 files changed, 52 insertions(+), 5 deletions(-) diff --git a/test/content/armoire.js b/test/content/armoire.js index 58fd5a4665..6882c2ef58 100644 --- a/test/content/armoire.js +++ b/test/content/armoire.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import armoire from '../../common/script/src/content/armoire'; describe('Armoire Locales', () => { diff --git a/test/content/backgrounds.js b/test/content/backgrounds.js index db526b24dd..562e110ced 100644 --- a/test/content/backgrounds.js +++ b/test/content/backgrounds.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import backgroundSets from '../../common/script/src/content/backgrounds'; import {each} from 'lodash'; diff --git a/test/content/eggs.js b/test/content/eggs.js index f8a7a08627..608ff6d8b6 100644 --- a/test/content/eggs.js +++ b/test/content/eggs.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import {allEggs} from '../../common/script/src/content/eggs'; import {each} from 'lodash'; diff --git a/test/content/faq.js b/test/content/faq.js index 557160ca53..8219aa3efb 100644 --- a/test/content/faq.js +++ b/test/content/faq.js @@ -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) => { diff --git a/test/content/food.js b/test/content/food.js index d9063ed0d6..868d781f79 100644 --- a/test/content/food.js +++ b/test/content/food.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import allFood from '../../common/script/src/content/food'; import {each} from 'lodash'; diff --git a/test/content/gear.js b/test/content/gear.js index 9fb067b55d..2d9faf1883 100644 --- a/test/content/gear.js +++ b/test/content/gear.js @@ -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) => { diff --git a/test/content/hatching-potions.js b/test/content/hatching-potions.js index 0de17f14fa..4c1ad41f7a 100644 --- a/test/content/hatching-potions.js +++ b/test/content/hatching-potions.js @@ -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'; diff --git a/test/content/health-potion.js b/test/content/health-potion.js index 4bfb6e6365..f677b5382f 100644 --- a/test/content/health-potion.js +++ b/test/content/health-potion.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import healthPotion from '../../common/script/src/content/health-potion'; describe('Health Potion Locales', () => { diff --git a/test/content/quests.js b/test/content/quests.js index fa051a7dcb..2ade38937f 100644 --- a/test/content/quests.js +++ b/test/content/quests.js @@ -1,4 +1,9 @@ +import { + expectValidTranslationString, + describeEachItem +} from '../helpers/content.helper'; import {each} from 'lodash'; + import { all as allQuests, byLevel as questsByLevel diff --git a/test/content/spells.js b/test/content/spells.js index 0dfb42b73b..44cfa74efc 100644 --- a/test/content/spells.js +++ b/test/content/spells.js @@ -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) => { diff --git a/test/content/user-defaults.js b/test/content/user-defaults.js index 15f0cb46b3..953f56bc5c 100644 --- a/test/content/user-defaults.js +++ b/test/content/user-defaults.js @@ -1,3 +1,7 @@ +import { + expectValidTranslationString +} from '../helpers/content.helper'; + import userDefaults from '../../common/script/src/content/user-defaults'; import {each} from 'lodash'; diff --git a/test/helpers/content.helper.js b/test/helpers/content.helper.js index 26eff01029..83178c1a52 100644 --- a/test/helpers/content.helper.js +++ b/test/helpers/content.helper.js @@ -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