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
it('has a valid text attribute', () => { } from '../../common/script/src/content/user-defaults';
expectValidTranslationString(type.text);
});
}
if (type.name) { describe('User Defaults', () => {
it('has a valid name attribute', () => { let tasks = {
expectValidTranslationString(type.name); habits: habits,
}); dailys: dailys,
} todos: todos,
rewards: rewards
};
if (type.notes) { describeEachItem('Tasks', tasks, (type, name) => {
it('has a valid notes attribute', () => { each(type, (task, index) => {
expectValidTranslationString(type.notes); it('has a valid text attribute', () => {
}); expectValidTranslationString(task.text);
}
});
}); });
it('has a valid type attribute', () => {
expect(task.type).to.match(/todo|daily|habit|reward/);
});
if (task.notes) {
it('has a valid notes attribute', () => {
expectValidTranslationString(task.notes);
});
}
}); });
}); });
describeEachItem('Tags', tags, (tag, index) => {
it('has a valid name attribute', () => {
expectValidTranslationString(tag.name);
});
});
}); });