From 70b3d0edf4b94436259ffbd331790fcc477e7016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 20 Dec 2018 22:30:14 +0100 Subject: [PATCH] add basic test for /health MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- test/app.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/app.js diff --git a/test/app.js b/test/app.js new file mode 100644 index 0000000..32c21b1 --- /dev/null +++ b/test/app.js @@ -0,0 +1,26 @@ +import { expect } from 'chai' +import sinon from 'sinon' +import request from 'supertest' + +import App from '../src/app' +import Builds from '../src/builds' +import Comments from '../src/comments' + +let comments +let app + +describe('App', () => { + beforeEach(() => { + comments = sinon.createStubInstance(Comments) + comments.db = sinon.createStubInstance(Builds), + app = App(comments) + }) + + describe('/health', () => { + it('should return OK', async () => { + let resp = await request(app.callback()).get('/health') + expect(resp.text).to.eq('OK') + expect(resp.status).to.eq(200) + }) + }) +})