Simplify gear tests and test more items

This commit is contained in:
Blade Barringer
2015-10-03 09:59:10 -05:00
parent 8eadecdc1a
commit a492649f71
9 changed files with 47 additions and 168 deletions

View File

@@ -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);
});
});
});
}

View File

@@ -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);
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});

View File

@@ -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);
});
});
});
});
});