From 56529f3fe10dbae934267b78408c1d4cbfb001e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 6 Jul 2020 18:59:59 +0200 Subject: [PATCH] add test for GET /builds/:repo/:pr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- test/app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/app.js b/test/app.js index 12bb275..1fe0263 100644 --- a/test/app.js +++ b/test/app.js @@ -14,6 +14,7 @@ describe('App', () => { ghc = sinon.createStubInstance(Comments) ghc.db = sinon.createStubInstance(Builds, { getComments: sample.COMMENTS, + getBuilds: sample.BUILDS, }), app = App({ghc}) }) @@ -28,7 +29,7 @@ describe('App', () => { }) describe('GET /comments', () => { - it('should return list of builds', async () => { + it('should return list of comments', async () => { const resp = await request(app.callback()) .get('/comments') expect(resp.body).to.eql({ @@ -54,6 +55,16 @@ describe('App', () => { }) }) + describe('GET /builds/:repo/:pr', () => { + it('should return list of builds', async () => { + const resp = await request(app.callback()) + .get('/builds/REPO-1/PR-1') + expect(resp.body).to.eql({ + count: sample.BUILDS.length, builds: sample.BUILDS, + }) + expect(resp.status).to.eq(200) + }) + }) describe('POST /builds/:repo/:pr/refresh', () => { it('should update github comment', async () => {