From e4246dae02260b2eb8b1d850fea00cc2b641e6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateu=20Aguil=C3=B3=20Bosch?= Date: Mon, 28 May 2018 11:43:24 +0200 Subject: [PATCH] test: add test coverage to the set up middleware --- src/middlewares/copyToRequestObject.test.js | 14 ++++++++++++++ src/routes/healthcheck.test.js | 1 + 2 files changed, 15 insertions(+) create mode 100644 src/middlewares/copyToRequestObject.test.js diff --git a/src/middlewares/copyToRequestObject.test.js b/src/middlewares/copyToRequestObject.test.js new file mode 100644 index 0000000..676dac7 --- /dev/null +++ b/src/middlewares/copyToRequestObject.test.js @@ -0,0 +1,14 @@ +// @flow + +const copyToRequestObject = require('./copyToRequestObject'); + +describe('The set up process', () => { + test('It can copy variables', () => { + expect.assertions(2); + const req = {}; + const next = jest.fn(); + copyToRequestObject({ foo: 'bar' })(req, null, next); + expect(req.foo).toBe('bar'); + expect(next).toHaveBeenCalled(); + }); +}); diff --git a/src/routes/healthcheck.test.js b/src/routes/healthcheck.test.js index 60644d9..c0a2930 100644 --- a/src/routes/healthcheck.test.js +++ b/src/routes/healthcheck.test.js @@ -4,6 +4,7 @@ const healthcheck = require('./healthcheck'); describe('The healthcheck route', () => { test('It responds', () => { + expect.assertions(2); const res = { set: jest.fn(), json: jest.fn(),