This commit is contained in:
Tyrel Souza 2017-11-29 23:18:47 -05:00
parent 9c7041a80f
commit 27ae801067
1 changed files with 5 additions and 6 deletions

View File

@ -10,7 +10,8 @@ beforeEach((done) => {
describe('POST /todos', () => {
it('should create a new todo', (done) => {
var text = 'X GON GIVE IT TO YA';
var text = 'Test todo text';
request(app)
.post('/todos')
.send({text})
@ -19,17 +20,15 @@ describe('POST /todos', () => {
expect(res.body.text).toBe(text);
})
.end((err, res) => {
if (err){
console.log(err);
if (err) {
return done(err);
}
Todo.find().then((todos) => {
expect(todos.length).toBe(1);
expect(todos[0].text).toBe(text);
done();
})
done();
}).catch((err) => done(err))
}).catch((e) => done(e));
});
});