Skip to content

Commit

Permalink
test: add test coverage to the healthcheck route
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateu Aguiló Bosch committed May 28, 2018
1 parent 2c5e925 commit a1904c7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .emdaer/docs/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ just meant to save ideas for documentation to process some other time._
- Filter requests that the CMS should not be bothered with using the resource lists.
- Make sure to mention that the _Contenta Redis_ module needs to be enabled.
- Make sure to mention that the /healthckeck is for auto-scaling policies.
- Create @contentacms/… submodules for logging interfaces like Splunk.
22 changes: 22 additions & 0 deletions src/routes/healthcheck.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @flow

const healthcheck = require('./healthcheck');

describe('The healthcheck route', () => {
test('It responds', () => {
const res = {
set: jest.fn(),
json: jest.fn(),
};
healthcheck(null, res);
expect(res.set).toHaveBeenCalledWith(
'Cache-Control',
'private, max-age=0, no-cache'
);
expect(res.json).toHaveBeenCalledWith({
meta: {
healthcheck: 'good',
},
});
});
});

0 comments on commit a1904c7

Please sign in to comment.