new tests

This commit is contained in:
Tyrel Souza 2017-11-29 23:24:51 -05:00
parent 27ae801067
commit d4b45e1bd8

View File

@ -28,7 +28,23 @@ describe('POST /todos', () => {
expect(todos.length).toBe(1); expect(todos.length).toBe(1);
expect(todos[0].text).toBe(text); expect(todos[0].text).toBe(text);
done(); done();
})
}).catch((e) => done(e)); }).catch((e) => done(e));
})
});
it('should NOT create a new todo', (done) => {
request(app)
.post('/todos')
.send()
.expect(400)
.end((err, res) => {
if (err) {
return done(err);
}
Todo.find().then((todos) => {
expect(todos.length).toBe(0);
done();
}).catch((e) => done(e));
})
}); });
}); });