From 2a696adfa30493e4592e816f61b320a3d732fbbe Mon Sep 17 00:00:00 2001 From: carlospelazas Date: Fri, 23 Feb 2024 08:19:19 +0100 Subject: [PATCH] tests for population question --- gatewayservice/gateway-service.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gatewayservice/gateway-service.test.js b/gatewayservice/gateway-service.test.js index 56eeb12..1eaa8d4 100644 --- a/gatewayservice/gateway-service.test.js +++ b/gatewayservice/gateway-service.test.js @@ -37,4 +37,20 @@ describe('Gateway Service', () => { expect(response.statusCode).toBe(200); expect(response.body.userId).toBe('mockedUserId'); }); + + it('should not support the country', async () => { + const response = await request(app) + .get('/populationQuestion') + .query({ country: 'invalidCountry' }); + + expect(response.statusCode).toBe(400); + }) + + it('should return population data', async () => { + const response = await request(app) + .get('/populationQuestion') + .query({ country: 'spain' }); + + expect(response.statusCode).toBe(200); + }) }); \ No newline at end of file