diff --git a/src/routes/v1/index.js b/src/routes/v1/index.js index 139fa23f..850e3c8f 100644 --- a/src/routes/v1/index.js +++ b/src/routes/v1/index.js @@ -29,7 +29,8 @@ defaultRoutes.forEach((route) => { router.use(route.path, route.route); }); -if (config.env !== 'production') { +/* istanbul ignore next */ +if (config.env === 'development') { devRoutes.forEach((route) => { router.use(route.path, route.route); }); diff --git a/tests/integration/docs.test.js b/tests/integration/docs.test.js new file mode 100644 index 00000000..4c3134fa --- /dev/null +++ b/tests/integration/docs.test.js @@ -0,0 +1,14 @@ +const request = require('supertest'); +const httpStatus = require('http-status'); +const app = require('../../src/app'); +const config = require('../../src/config/config'); + +describe('Auth routes', () => { + describe('GET /v1/docs', () => { + test('should return 404 when running in production', async () => { + config.env = 'production'; + await request(app).get('/v1/docs').expect(httpStatus.NOT_FOUND); + config.env = process.env.NODE_ENV; + }); + }); +});