habitica-self-host/test/content/gear.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

import {
expectValidTranslationString,
} from '../helpers/content.helper';
2015-11-16 23:29:13 +00:00
import { each } from 'lodash';
2015-11-16 23:29:13 +00:00
import { tree as allGear } from '../../common/script/content/gear';
2015-10-03 14:34:56 +00:00
describe('Gear', () => {
2015-11-16 23:29:13 +00:00
each(allGear, (piece, gearType) => {
describe(gearType, () => {
each(piece, (items, klass) => {
context(`${klass} ${gearType}s`, () => {
it('have a value of at least 0 for each stat', () => {
each(items, (gear, itemKey) => {
expect(gear.con).to.be.at.least(0);
expect(gear.int).to.be.at.least(0);
expect(gear.per).to.be.at.least(0);
expect(gear.str).to.be.at.least(0);
});
});
it('have a purchase value of at least 0', () => {
each(items, (gear, itemKey) => {
expect(gear.value).to.be.at.least(0);
});
});
it('has a canBuy function', () => {
each(items, (gear, itemKey) => {
expect(gear.canBuy).to.be.a('function');
});
});
it('have valid translation strings for text and notes', () => {
each(items, (gear, itemKey) => {
expectValidTranslationString(gear.text);
expectValidTranslationString(gear.notes);
});
});
});
});
});
});
2015-11-16 23:29:13 +00:00
});