Added more negative tests for the teams

ref #17
This commit is contained in:
Nicolai Ort 2020-12-09 18:47:15 +01:00
parent 862834c877
commit b4b52717fc
1 changed files with 12 additions and 4 deletions

View File

@ -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', () => {