From b4b52717fcbb40f0aaebb5c8372715e365342b8c Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 9 Dec 2020 18:47:15 +0100 Subject: [PATCH] Added more negative tests for the teams ref #17 --- src/tests/runnerTeams/team_add+get.spec.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/tests/runnerTeams/team_add+get.spec.ts b/src/tests/runnerTeams/team_add+get.spec.ts index 69d85ed..79505ad 100644 --- a/src/tests/runnerTeams/team_add+get.spec.ts +++ b/src/tests/runnerTeams/team_add+get.spec.ts @@ -11,20 +11,28 @@ describe('GET /api/teams', () => { }); // --------------- describe('POST /api/teams with errors', () => { - it('creating a new org with without a team should return 400', async () => { + it('creating a new team without a name should return 400', async () => { const res1 = await axios.post(base + '/api/teams', { - "name": "test_team" + "name": null }, { validateStatus: undefined }); expect(res1.status).toEqual(400); expect(res1.headers['content-type']).toContain("application/json") }); - it('creating a new org with without a name should return 400', async () => { + it('creating a new team without a org should return 400', async () => { const res2 = await axios.post(base + '/api/teams', { - "name": null + "name": "test_team" }, { validateStatus: undefined }); expect(res2.status).toEqual(400); expect(res2.headers['content-type']).toContain("application/json") }); + it('creating a new team without a valid org should return 404', async () => { + const res3 = await axios.post(base + '/api/teams', { + "name": "test_team", + "parentGroup": -1 + }, { validateStatus: undefined }); + expect(res3.status).toEqual(404); + expect(res3.headers['content-type']).toContain("application/json") + }); }); // --------------- describe('POST /api/teams working', () => {