From 0b71d64651cdcefbcf9132dc2372747695f3dabd Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 11 Nov 2016 16:36:51 +0100 Subject: [PATCH] fix db test --- test/unit/routes/health-check.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/unit/routes/health-check.js b/test/unit/routes/health-check.js index 21b0272aa9..3c71c0e4bb 100644 --- a/test/unit/routes/health-check.js +++ b/test/unit/routes/health-check.js @@ -23,11 +23,20 @@ describe('Unit: The health cheack api', () => { }); it('should give 500 when db is failing', (done) => { - db.select = () => from = () => Promise.reject(); + db.select = () => { + return { + from: () => Promise.reject(new Error('db error')) + } + } request .get('/health') - .expect(500, done); + .expect(500) + .end((err, res) => { + assert.equal(res.status, 500) + assert.equal(res.body.health, 'BAD'); + done(); + }); }); it('should give 200 when db is not failing', (done) => {