diff --git a/server/tests/server.test.js b/server/tests/server.test.js index fc695f1..f85fc75 100644 --- a/server/tests/server.test.js +++ b/server/tests/server.test.js @@ -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)); }); - });