mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-18 19:58:52 +00:00
fix(test): remove test for old function
This commit is contained in:
parent
2a054a25ee
commit
a71e44b331
1 changed files with 0 additions and 90 deletions
|
|
@ -1,90 +0,0 @@
|
|||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import moment from 'moment';
|
||||
|
||||
import Task from '@/components/tasks/task.vue';
|
||||
import Store from '@/libs/store';
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Store);
|
||||
|
||||
describe('Task', () => {
|
||||
let wrapper;
|
||||
|
||||
function makeWrapper (additionalTaskData = {}, additionalUserData = {}) {
|
||||
return shallowMount(Task, {
|
||||
propsData: {
|
||||
task: {
|
||||
group: {},
|
||||
...additionalTaskData,
|
||||
},
|
||||
},
|
||||
store: {
|
||||
state: {
|
||||
user: {
|
||||
data: {
|
||||
preferences: {
|
||||
dateFormat: 'MM/dd/yyyy',
|
||||
},
|
||||
...additionalUserData,
|
||||
},
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
'tasks:getTaskClasses': () => ({}),
|
||||
'tasks:canEdit': () => ({}),
|
||||
'tasks:canDelete': () => ({}),
|
||||
},
|
||||
},
|
||||
mocks: { $t: (key, params) => key + (params ? JSON.stringify(params) : '') },
|
||||
directives: { 'b-tooltip': {} },
|
||||
localVue,
|
||||
});
|
||||
}
|
||||
|
||||
it('returns a vue instance', () => {
|
||||
wrapper = makeWrapper();
|
||||
expect(wrapper.isVueInstance()).to.be.true;
|
||||
});
|
||||
|
||||
describe('Due date calculation', () => {
|
||||
let clock;
|
||||
|
||||
function setClockTo (time) {
|
||||
const now = moment(time);
|
||||
clock = sinon.useFakeTimers(now.toDate());
|
||||
return now;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
clock.restore();
|
||||
});
|
||||
|
||||
it('formats due date to today if due today', () => {
|
||||
const now = setClockTo('2019-09-17T17:57:00+02:00');
|
||||
wrapper = makeWrapper({ date: now });
|
||||
|
||||
expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"today"}');
|
||||
});
|
||||
|
||||
it('formats due date to tomorrow if due tomorrow', () => {
|
||||
const now = setClockTo('2012-06-12T14:17:28Z');
|
||||
wrapper = makeWrapper({ date: now.add(1, 'day') });
|
||||
|
||||
expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in a day"}');
|
||||
});
|
||||
|
||||
it('formats due date to 5 days if due in 5 days', () => {
|
||||
const now = setClockTo();
|
||||
wrapper = makeWrapper({ date: now.add(5, 'days') });
|
||||
|
||||
expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in 5 days"}');
|
||||
});
|
||||
|
||||
it('formats due date to tomorrow if today but before dayStart', () => {
|
||||
const now = setClockTo('2019-06-12T04:23:37+02:00');
|
||||
wrapper = makeWrapper({ date: now.add(8, 'hours') }, { preferences: { dayStart: 7 } });
|
||||
|
||||
expect(wrapper.vm.formatDueDate()).to.equal('dueIn{"dueIn":"in a day"}');
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue