diff --git a/server/tests/server.test.js b/server/tests/server.test.js index 24322ff..6a917af 100644 --- a/server/tests/server.test.js +++ b/server/tests/server.test.js @@ -107,7 +107,15 @@ describe("DELETE /todos/:id", () => { .expect((res) => { expect(res.body.todo.text).toBe(dummy[0].text) }) - .end(done) + .end((err, res) => { + if(err){ + return done(err); + } + Todo.findById(dummy[0]._id.toHexString()).then((todo) => { + expect(todo).toNotExist(); + done(); + }).catch((e) => done(e)); + }); }); it("should return a 404 if todo not found", (done) => { request(app) @@ -117,7 +125,7 @@ describe("DELETE /todos/:id", () => { }); it("should return a 404 if id is bad", (done) => { request(app) - .delete(`/todos/${dummy[0]._id.toHexString()}11111`) + .delete(`/todos/123`) .expect(404) .end(done) });