delete tests
This commit is contained in:
parent
f239700c3c
commit
4dc0674c3a
@ -98,3 +98,27 @@ describe("GET /todos/:id", () => {
|
||||
.end(done)
|
||||
})
|
||||
});
|
||||
|
||||
describe("DELETE /todos/:id", () => {
|
||||
it("should delete a single todo", (done) => {
|
||||
request(app)
|
||||
.delete(`/todos/${dummy[0]._id.toHexString()}`)
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.body.todo.text).toBe(dummy[0].text)
|
||||
})
|
||||
.end(done)
|
||||
});
|
||||
it("should return a 404 if todo not found", (done) => {
|
||||
request(app)
|
||||
.delete(`/todos/${new ObjectID()}`)
|
||||
.expect(404)
|
||||
.end(done)
|
||||
});
|
||||
it("should return a 404 if id is bad", (done) => {
|
||||
request(app)
|
||||
.delete(`/todos/${dummy[0]._id.toHexString()}11111`)
|
||||
.expect(404)
|
||||
.end(done)
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user