mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
Expand user defaults test
This commit is contained in:
@@ -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) {
|
||||
it('has a valid text attribute', () => {
|
||||
expectValidTranslationString(type.text);
|
||||
});
|
||||
}
|
||||
import {
|
||||
habits,
|
||||
dailys,
|
||||
todos,
|
||||
rewards,
|
||||
tags
|
||||
} from '../../common/script/src/content/user-defaults';
|
||||
|
||||
if (type.name) {
|
||||
it('has a valid name attribute', () => {
|
||||
expectValidTranslationString(type.name);
|
||||
});
|
||||
}
|
||||
describe('User Defaults', () => {
|
||||
let tasks = {
|
||||
habits: habits,
|
||||
dailys: dailys,
|
||||
todos: todos,
|
||||
rewards: rewards
|
||||
};
|
||||
|
||||
if (type.notes) {
|
||||
it('has a valid notes attribute', () => {
|
||||
expectValidTranslationString(type.notes);
|
||||
});
|
||||
}
|
||||
});
|
||||
describeEachItem('Tasks', tasks, (type, name) => {
|
||||
each(type, (task, index) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user