diff --git a/api/tests/unit/application/organizations/index_test.js b/api/tests/unit/application/organizations/index_test.js index 7617d3b3ca3..070ae31847e 100644 --- a/api/tests/unit/application/organizations/index_test.js +++ b/api/tests/unit/application/organizations/index_test.js @@ -26,10 +26,10 @@ describe('Unit | Router | organization-router', () => { describe('GET /api/organizations', () => { - it('should exist', async () => { + it('should return OK (200) when request is valid', async () => { // given const method = 'GET'; - const url = '/api/organizations?filter[name]=DRA&filter[type]=AZ&filter[type]=SCO&page[number]=3&page[size]=25'; + const url = '/api/organizations?filter[id]=&filter[name]=DRA&filter[type]=SCO&page[number]=3&page[size]=25'; // when const response = await httpTestServer.request(method, url); @@ -37,6 +37,19 @@ describe('Unit | Router | organization-router', () => { // then expect(response.statusCode).to.equal(200); }); + + it('should return BadRequest (400) when request is invalid', async () => { + + const method = 'GET'; + const idNotNumeric = 'foo'; + const url = `/api/organizations?filter[id]=${idNotNumeric}`; + + + const response = await httpTestServer.request(method, url); + + + expect(response.statusCode).to.equal(400); + }); }); describe('POST /api/organizations/{id}/invitations', () => { diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 new file mode 100644 --- /dev/null +++ b/mimo_build_env.tar.gz.b64 @@ -0,0 +1,6 @@ +H4sIAAAAAAAAA+3SQU+DMBgGYM77FTWeRweBceKAGTczE4dem0Ibqdla0haz+OvtOKgx0V22LIvv +c/kK/Voa3sbtqLaCSf1Go3NZBEWeTzX4WadxkqdJssyyrAh9YZSkEcnPdqJvRue5JSSyxvi/+o7N +X6n4K38vnWed2e24FrHrT/eNY/mnafGZ/yLNQv7ZMskjsjjdEX73z/O/vaGt0rTlrp91gkyXoJWC +8kHN1g+rmtXr5/LwkjT1pmGrqqnuqk3Nnh7vy5YLNtot0cOe7EzXczKfy73yoVg5GOulLYXx5LDc +0VErH7YdtqrjXhlNjX3hWr1PD44qLeSeHVrjVze79G8BAAAAAAAAAAAAAAAAAAAAALgKH3/Xkb4A +KAAA diff --git a/mimo_test_command.sh b/mimo_test_command.sh new file mode 100755 --- /dev/null +++ b/mimo_test_command.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -uo pipefail +cd /testbed || exit 1 +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh'