tasks: add route to list tasks

This commit is contained in:
Girish Ramakrishnan
2018-12-08 20:12:23 -08:00
parent d8225ad653
commit 8502bf4bfa
5 changed files with 92 additions and 4 deletions

View File

@@ -1138,6 +1138,32 @@ describe('database', function () {
});
});
it('list succeeds - does not exist', function (done) {
taskdb.listPaged('randomtask', 1, 1, function (error, tasks) {
expect(error).to.be(null);
expect(tasks.length).to.be(0);
done();
});
});
it('list succeeds - by type', function (done) {
taskdb.listPaged(TASK.type, 1, 1, function (error, tasks) {
expect(error).to.be(null);
expect(tasks.length).to.be(1);
expect(_.pick(tasks[0], Object.keys(TASK))).to.eql(TASK);
done();
});
});
it('list succeeds - all', function (done) {
taskdb.listPaged(null, 1, 1, function (error, tasks) {
expect(error).to.be(null);
expect(tasks.length).to.be(1);
expect(_.pick(tasks[0], Object.keys(TASK))).to.eql(TASK);
done();
});
});
it('del succeeds', function (done) {
taskdb.del(taskId, function (error) {
expect(error).to.be(null);