From a492649f717edfa93d775cf163a77dd7d65d1b45 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sat, 3 Oct 2015 09:59:10 -0500 Subject: [PATCH] Simplify gear tests and test more items --- test/content/gear.js | 48 ++++++++++++++++++++++++++++- test/content/gear/armor.js | 41 ------------------------ test/content/gear/back.js | 18 ----------- test/content/gear/body.js | 18 ----------- test/content/gear/eyewear.js | 18 ----------- test/content/gear/head-accessory.js | 18 ----------- test/content/gear/head.js | 18 ----------- test/content/gear/shield.js | 18 ----------- test/content/gear/weapon.js | 18 ----------- 9 files changed, 47 insertions(+), 168 deletions(-) delete mode 100644 test/content/gear/armor.js delete mode 100644 test/content/gear/back.js delete mode 100644 test/content/gear/body.js delete mode 100644 test/content/gear/eyewear.js delete mode 100644 test/content/gear/head-accessory.js delete mode 100644 test/content/gear/head.js delete mode 100644 test/content/gear/shield.js delete mode 100644 test/content/gear/weapon.js diff --git a/test/content/gear.js b/test/content/gear.js index fa737e4640..056d1fea81 100644 --- a/test/content/gear.js +++ b/test/content/gear.js @@ -1,3 +1,49 @@ +import {tree as allGear} from '../../common/script/src/content/gear'; +import {each} from 'lodash'; + describe('Gear', () => { - runTestsInDirectory('gear'); + each(allGear, (piece, type) => { + describeEachItem(type, piece, (set, key) => { + checkGearAttributes(set); + }); + }); }); + +function checkGearAttributes(set) { + each(set, (gear, key) => { + describe(`${key}`, () => { + + it('has a value attribute', () => { + expect(gear.value).to.be.at.least(0); + }); + + it('has a valid con attribute', () => { + expect(gear.con).to.be.at.least(0); + }); + + it('has a valid int attribute', () => { + expect(gear.int).to.be.at.least(0); + }); + + it('has a valid per attribute', () => { + expect(gear.per).to.be.at.least(0); + }); + + it('has a valid str attribute', () => { + expect(gear.str).to.be.at.least(0); + }); + + it('has a canBy function', () => { + expect(gear.canBuy).to.be.a('function'); + }); + + it('has a valid text attribute', () => { + expectValidTranslationString(gear.text); + }); + + it('has a valid notes attribute', () => { + expectValidTranslationString(gear.notes); + }); + }); + }); +} diff --git a/test/content/gear/armor.js b/test/content/gear/armor.js deleted file mode 100644 index 28ec7f8401..0000000000 --- a/test/content/gear/armor.js +++ /dev/null @@ -1,41 +0,0 @@ -import {tree as allGear} from '../../../common/script/src/content/gear'; -import {each} from 'lodash'; - -describeEachItem('Armor', allGear.armor, (set, key) => { - each(set, (gear, key) => { - describe(`${key} Armor`, () => { - - it('has a value attribute', () => { - expect(gear.value).to.be.at.least(0); - }); - - it('has a valid con attribute', () => { - expect(gear.con).to.be.at.least(0); - }); - - it('has a valid int attribute', () => { - expect(gear.int).to.be.at.least(0); - }); - - it('has a valid per attribute', () => { - expect(gear.per).to.be.at.least(0); - }); - - it('has a valid str attribute', () => { - expect(gear.str).to.be.at.least(0); - }); - - it('has a canBy function', () => { - expect(gear.canBuy).to.be.a('function'); - }); - - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); -}); diff --git a/test/content/gear/back.js b/test/content/gear/back.js deleted file mode 100644 index a2d58b2faa..0000000000 --- a/test/content/gear/back.js +++ /dev/null @@ -1,18 +0,0 @@ -import back from '../../../common/script/src/content/gear/back'; -import {each} from 'lodash'; - -describe('Back', () => { - each(back, (set) => { - each(set, (gear, key) => { - describe(`${key} Back`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/body.js b/test/content/gear/body.js deleted file mode 100644 index 5017046137..0000000000 --- a/test/content/gear/body.js +++ /dev/null @@ -1,18 +0,0 @@ -import body from '../../../common/script/src/content/gear/body'; -import {each} from 'lodash'; - -describe('Body', () => { - each(body, (set) => { - each(set, (gear, key) => { - describe(`${key} Body`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/eyewear.js b/test/content/gear/eyewear.js deleted file mode 100644 index d5473c4274..0000000000 --- a/test/content/gear/eyewear.js +++ /dev/null @@ -1,18 +0,0 @@ -import eyewear from '../../../common/script/src/content/gear/eyewear'; -import {each} from 'lodash'; - -describe('Eyewear', () => { - each(eyewear, (set) => { - each(set, (gear, key) => { - describe(`${key} Eyewear`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/head-accessory.js b/test/content/gear/head-accessory.js deleted file mode 100644 index a305832f63..0000000000 --- a/test/content/gear/head-accessory.js +++ /dev/null @@ -1,18 +0,0 @@ -import headAccessory from '../../../common/script/src/content/gear/head-accessory'; -import {each} from 'lodash'; - -describe('Head Accessory', () => { - each(headAccessory, (set) => { - each(set, (gear, key) => { - describe(`${key} Head Accessory`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/head.js b/test/content/gear/head.js deleted file mode 100644 index 9cdd0ceee8..0000000000 --- a/test/content/gear/head.js +++ /dev/null @@ -1,18 +0,0 @@ -import head from '../../../common/script/src/content/gear/head'; -import {each} from 'lodash'; - -describe('Head', () => { - each(head, (set) => { - each(set, (gear, key) => { - describe(`${key} Head`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/shield.js b/test/content/gear/shield.js deleted file mode 100644 index 96c78df569..0000000000 --- a/test/content/gear/shield.js +++ /dev/null @@ -1,18 +0,0 @@ -import shield from '../../../common/script/src/content/gear/shield'; -import {each} from 'lodash'; - -describe('Shield', () => { - each(shield, (set) => { - each(set, (gear, key) => { - describe(`${key} Shield`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -}); diff --git a/test/content/gear/weapon.js b/test/content/gear/weapon.js deleted file mode 100644 index a93f0c546a..0000000000 --- a/test/content/gear/weapon.js +++ /dev/null @@ -1,18 +0,0 @@ -import weapon from '../../../common/script/src/content/gear/weapon'; -import {each} from 'lodash'; - -describe('Weapon', () => { - each(weapon, (set) => { - each(set, (gear, key) => { - describe(`${key} Weapon`, () => { - it('has a valid text attribute', () => { - expectValidTranslationString(gear.text); - }); - - it('has a valid notes attribute', () => { - expectValidTranslationString(gear.notes); - }); - }); - }); - }); -});