March 2018
Intermediate to advanced
592 pages
13h 44m
English
To do that, we have to call Todo.find. Now, Todo.find is really similar to the MongoDB native find method we used. We can call it with no arguments to fetch everything in that collection. In this case, we'll be fetching all of the Todos. Next up, we can attach a then callback. We're going to get this function called with all todos, and we can make some assertions about that.
.end((err, res) => { if(err) { return done(err); }Todo.find().then((todos) => {
})
In this case, we're going to assert that the Todo we created does exist. We'll get started by expecting todos.length to toBe equal to the number 1, because we've added one Todo item. We're going to make one more assertion. We're going ...