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 {
expectValidTranslationString
expectValidTranslationString,
describeEachItem
} from '../helpers/content.helper';
import userDefaults from '../../common/script/src/content/user-defaults';
import {each} from 'lodash';
describe('User Default Locales', () => {
each(userDefaults, (types, key) => {
describe(`${key}`, () => {
each(types, (type, index) => {
describe(`${key}[${index}]`, () => {
if (type.text) {
import {
habits,
dailys,
todos,
rewards,
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', () => {
expectValidTranslationString(type.text);
expectValidTranslationString(task.text);
});
}
if (type.name) {
it('has a valid name attribute', () => {
expectValidTranslationString(type.name);
it('has a valid type attribute', () => {
expect(task.type).to.match(/todo|daily|habit|reward/);
});
}
if (type.notes) {
if (task.notes) {
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);
});
});
});