This commit is contained in:
Tyrel Souza 2017-11-29 23:18:47 -05:00
parent 9c7041a80f
commit 27ae801067

View File

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