Add test for preventing task with id that already exists

This commit is contained in:
Blade Barringer
2015-06-09 12:44:49 -05:00
parent 05286d1e8f
commit ec3b32fccb
+21
View File
@@ -97,6 +97,27 @@ describe "Todos", ->
expect(todo.value).to.equal 0
done()
it "Does not create a todo with an id that already exists", (done) ->
original_todo = {
type: "todo"
text: "original todo"
id: "custom-id"
}
duplicate_id_todo = {
type: "todo"
text: "not original todo"
id: "custom-id"
}
request.post(baseURL + "/user/tasks").send(
original_todo
).end (res) ->
request.post(baseURL + "/user/tasks").send(
duplicate_id_todo
).end (res) ->
expectCode res, 409
expect(res.body.err).to.eql('A task with that ID already exists.')
done()
describe "Updating todos", ->
it "Does not update id of todo", (done) ->
request.put(baseURL + "/user/tasks/" + todo.id).send(