mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
fix tests
This commit is contained in:
parent
cb08c383b9
commit
955b0f042b
3 changed files with 34 additions and 21 deletions
|
|
@ -58,8 +58,6 @@ describe('POST /tasks', () => {
|
|||
|
||||
it('ignores setting challenge field');
|
||||
|
||||
it('ignores setting value field');
|
||||
|
||||
it('ignores setting completed field');
|
||||
|
||||
it('ignores setting streak field');
|
||||
|
|
@ -127,7 +125,7 @@ describe('POST /tasks', () => {
|
|||
expect(task.type).to.eql('daily');
|
||||
expect(task.frequency).to.eql('daily');
|
||||
expect(task.everyX).to.eql(5);
|
||||
expect(task.startDate).to.eql(now);
|
||||
expect(new Date(task.startDate)).to.eql(now);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -22,15 +22,7 @@ describe('PUT /tasks/:id', () => {
|
|||
// task = createdTask
|
||||
});
|
||||
|
||||
it('returns an error if req.body.type is not valid', () => {
|
||||
return expect(api.put(`/tasks/${task._id}`, {
|
||||
type: 'habitF',
|
||||
})).to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('invalidReqParams'),
|
||||
});
|
||||
});
|
||||
it('ignores setting type field');
|
||||
|
||||
it('ignores setting userId field');
|
||||
|
||||
|
|
@ -57,8 +49,13 @@ describe('PUT /tasks/:id', () => {
|
|||
let habit;
|
||||
|
||||
beforeEach(() => {
|
||||
// create existing habit
|
||||
// habit = createdHabit;
|
||||
return api.post('/tasks', {
|
||||
text: 'test habit',
|
||||
type: 'habit',
|
||||
notes: 1976,
|
||||
}).then((createdHabit) => {
|
||||
habit = createdHabit;
|
||||
});
|
||||
});
|
||||
|
||||
it('updates a habit', () => {
|
||||
|
|
@ -80,8 +77,13 @@ describe('PUT /tasks/:id', () => {
|
|||
let todo;
|
||||
|
||||
beforeEach(() => {
|
||||
// create existing todo
|
||||
// todo = createdTodo;
|
||||
return api.post('/tasks', {
|
||||
text: 'test todo',
|
||||
type: 'todo',
|
||||
notes: 1976,
|
||||
}).then((createdTodo) => {
|
||||
todo = createdTodo;
|
||||
});
|
||||
});
|
||||
|
||||
it('updates a todo', () => {
|
||||
|
|
@ -101,8 +103,13 @@ describe('PUT /tasks/:id', () => {
|
|||
let daily;
|
||||
|
||||
beforeEach(() => {
|
||||
// create existing daily
|
||||
// daily = createdDaily;
|
||||
return api.post('/tasks', {
|
||||
text: 'test daily',
|
||||
type: 'daily',
|
||||
notes: 1976,
|
||||
}).then((createdDaily) => {
|
||||
daily = createdDaily;
|
||||
});
|
||||
});
|
||||
|
||||
it('updates a daily', () => {
|
||||
|
|
@ -134,8 +141,14 @@ describe('PUT /tasks/:id', () => {
|
|||
let reward;
|
||||
|
||||
beforeEach(() => {
|
||||
// create existing reward
|
||||
// reward = createdReward;
|
||||
return api.post('/tasks', {
|
||||
text: 'test reward',
|
||||
type: 'reward',
|
||||
notes: 1976,
|
||||
value: 10,
|
||||
}).then((createdReward) => {
|
||||
reward = createdReward;
|
||||
});
|
||||
});
|
||||
|
||||
it('updates a reward', () => {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ export let TaskSchema = new Schema({
|
|||
}, discriminatorOptions));
|
||||
|
||||
TaskSchema.plugin(baseModel, {
|
||||
noSet: ['challenge', 'userId', 'value', 'completed', 'history', 'streak', 'dateCompleted'], // TODO checklist fields editable?
|
||||
// TODO checklist fields editable?
|
||||
// TODO value should be settable only for rewards
|
||||
noSet: ['challenge', 'userId', 'completed', 'history', 'streak', 'dateCompleted'],
|
||||
private: [],
|
||||
timestamps: true,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue