70b6501135
* Refactoring & Feature: edit/delete group and challenge tasks - Remove showOption from tasks props - Pass all needed data to task for understand in mapGetter function which controls we should show - Improve current solution with edit and delete logic * Fix: this in template * Fix & Test: extend tests, fix can Edit/Delete functions
20 lines
583 B
JavaScript
20 lines
583 B
JavaScript
import generateStore from 'client/store';
|
|
|
|
describe('canDelete getter', () => {
|
|
it('cannot delete active challenge task', () => {
|
|
const store = generateStore();
|
|
|
|
|
|
const task = {userId: 1, challenge: {id: 2}};
|
|
expect(store.getters['tasks:canDelete'](task, 'challenge', true, null, null)).to.equal(false);
|
|
});
|
|
|
|
it('can delete broken challenge task', () => {
|
|
const store = generateStore();
|
|
|
|
|
|
const task = {userId: 1, challenge: {id: 2, broken: true}};
|
|
expect(store.getters['tasks:canDelete'](task, 'challenge', true, null, null)).to.equal(true);
|
|
});
|
|
});
|