Added tests for cron (#7081)

* Added inital cron tests

* Added more subscribe tests and updated various tests for syntax and expectations
This commit is contained in:
Keith Holliday
2016-04-23 17:54:50 -05:00
committed by Matteo Pagliazzi
parent c608d03e35
commit 050539d8f3
6 changed files with 1058 additions and 267 deletions

View File

@@ -6,6 +6,7 @@ import { model as Group } from '../../website/src/models/group';
import mongo from './mongo'; // eslint-disable-line
import moment from 'moment';
import i18n from '../../common/script/i18n';
import * as Tasks from '../../website/src/models/task';
afterEach((done) => {
sandbox.restore();
@@ -70,3 +71,33 @@ export function generateHistory (days) {
return history;
}
export function generateTodo (user) {
let todo = {
text: 'test todo',
type: 'todo',
value: 0,
completed: false,
};
let task = new Tasks.todo(Tasks.Task.sanitize(todo)); // eslint-disable-line babel/new-cap
task.userId = user._id;
task.save();
return task;
}
export function generateDaily (user) {
let daily = {
text: 'test daily',
type: 'daily',
value: 0,
completed: false,
};
let task = new Tasks.daily(Tasks.Task.sanitize(daily)); // eslint-disable-line babel/new-cap
task.userId = user._id;
task.save();
return task;
}