Added better tests to ensure tasks are synced

This commit is contained in:
Keith Holliday
2016-03-01 14:38:09 -06:00
parent 6e732a67c9
commit 20621b940e
2 changed files with 15 additions and 8 deletions
+1
View File
@@ -97,6 +97,7 @@ schema.methods.syncToUser = async function syncChallengeToUser (user) {
let [challengeTasks, userTasks] = await Q.all([
// Find original challenge tasks
Tasks.Task.find({
userId: {$exists: false},
'challenge.id': challenge._id,
}).exec(),
// Find user's tasks linked to this challenge