Expand user defaults test

This commit is contained in:
Blade Barringer
2015-10-03 11:04:04 -05:00
parent 4b46a0e9fc
commit 95a17f6fbb

View File

@@ -1,34 +1,47 @@
import { import {
expectValidTranslationString expectValidTranslationString,
describeEachItem
} from '../helpers/content.helper'; } from '../helpers/content.helper';
import userDefaults from '../../common/script/src/content/user-defaults';
import {each} from 'lodash'; import {each} from 'lodash';
describe('User Default Locales', () => { import {
each(userDefaults, (types, key) => { habits,
describe(`${key}`, () => { dailys,
each(types, (type, index) => { todos,
describe(`${key}[${index}]`, () => { rewards,
if (type.text) { tags
} from '../../common/script/src/content/user-defaults';
describe('User Defaults', () => {
let tasks = {
habits: habits,
dailys: dailys,
todos: todos,
rewards: rewards
};
describeEachItem('Tasks', tasks, (type, name) => {
each(type, (task, index) => {
it('has a valid text attribute', () => { it('has a valid text attribute', () => {
expectValidTranslationString(type.text); expectValidTranslationString(task.text);
}); });
}
if (type.name) { it('has a valid type attribute', () => {
it('has a valid name attribute', () => { expect(task.type).to.match(/todo|daily|habit|reward/);
expectValidTranslationString(type.name);
}); });
}
if (type.notes) { if (task.notes) {
it('has a valid notes attribute', () => { it('has a valid notes attribute', () => {
expectValidTranslationString(type.notes); expectValidTranslationString(task.notes);
}); });
} }
}); });
}); });
describeEachItem('Tags', tags, (tag, index) => {
it('has a valid name attribute', () => {
expectValidTranslationString(tag.name);
}); });
}); });
}); });