mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Upgrade tests tools and lint migrations and scripts (part 2) (#9998)
* upgrade gulp-babel * upgrade babel-eslint * upgrade eslint-friendly-formatter * start upgrading chai * start to upgrade eslint * restore skipped tests * start to upgrqde monk * fix linting and remove unused file * fix mocha notifications, and common tests * fix unit tests * start to fix initrgration tests * more integration tests fixes * upgrade monk to latest version * lint /scripts * migrations: start moving to /archive unused migrations and run eslint with --fix * lint migrations * fix more integration tests * fix test
This commit is contained in:
@@ -1,82 +0,0 @@
|
||||
import taskClasses from '../../../website/common/script/libs/taskClasses';
|
||||
|
||||
describe('taskClasses', () => {
|
||||
let task = {};
|
||||
let filters = {};
|
||||
let result;
|
||||
|
||||
describe('a todo task', () => {
|
||||
beforeEach(() => {
|
||||
task = { type: 'todo', _editing: false, tags: [] };
|
||||
});
|
||||
|
||||
it('is hidden', () => {
|
||||
filters = { a: true };
|
||||
result = taskClasses(task, filters, 0, Number(new Date()), false, true);
|
||||
expect(result).to.eql('hidden');
|
||||
});
|
||||
it('is beingEdited', () => {
|
||||
task._editing = true;
|
||||
result = taskClasses(task, filters);
|
||||
expect(result.split(' ').indexOf('beingEdited')).to.not.eql(-1);
|
||||
});
|
||||
it('is completed', () => {
|
||||
task.completed = true;
|
||||
result = taskClasses(task, filters);
|
||||
expect(result.split(' ').indexOf('completed')).to.not.eql(-1);
|
||||
task.completed = false;
|
||||
result = taskClasses(task, filters);
|
||||
expect(result.split(' ').indexOf('completed')).to.eql(-1);
|
||||
expect(result.split(' ').indexOf('uncompleted')).to.not.eql(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a daily task', () => {
|
||||
it('is completed', () => {
|
||||
task = { type: 'daily' };
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('completed')).to.not.eql(-1);
|
||||
});
|
||||
|
||||
it('is uncompleted'); // this requires stubbing the internal dependency shouldDo in taskClasses
|
||||
});
|
||||
|
||||
describe('a habit', () => {
|
||||
it('that is wide', () => {
|
||||
task = { type: 'habit', up: true, down: true };
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('habit-wide')).to.not.eql(-1);
|
||||
});
|
||||
it('that is narrow', () => {
|
||||
task = { type: 'habit' };
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('habit-narrow')).to.not.eql(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('varies based on priority', () => {
|
||||
it('trivial', () => {
|
||||
task.priority = 0.1;
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('difficulty-trivial')).to.not.eql(-1);
|
||||
});
|
||||
it('hard', () => {
|
||||
task.priority = 2;
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('difficulty-hard')).to.not.eql(-1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('varies based on value', () => {
|
||||
it('color-worst', () => {
|
||||
task.value = -30;
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('color-worst')).to.not.eql(-1);
|
||||
});
|
||||
it('color-neutral', () => {
|
||||
task.value = 0;
|
||||
result = taskClasses(task);
|
||||
expect(result.split(' ').indexOf('color-neutral')).to.not.eql(-1);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user