From d4b45e1bd86a4ea646336ca50036e21a884d9890 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Wed, 29 Nov 2017 23:24:51 -0500 Subject: [PATCH] new tests --- server/tests/server.test.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/server/tests/server.test.js b/server/tests/server.test.js index f85fc75..fc80f72 100644 --- a/server/tests/server.test.js +++ b/server/tests/server.test.js @@ -28,7 +28,23 @@ describe('POST /todos', () => { expect(todos.length).toBe(1); expect(todos[0].text).toBe(text); done(); - }) - }).catch((e) => done(e)); + }).catch((e) => done(e)); + }) + }); + + it('should NOT create a new todo', (done) => { + request(app) + .post('/todos') + .send() + .expect(400) + .end((err, res) => { + if (err) { + return done(err); + } + Todo.find().then((todos) => { + expect(todos.length).toBe(0); + done(); + }).catch((e) => done(e)); + }) }); });