Added bad test to the put

This commit is contained in:
Nicolai Ort 2020-12-09 17:56:37 +01:00
parent 42d3f9cb98
commit 4e3b038dec

View File

@ -16,13 +16,12 @@ describe('adding + updating name', () => {
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
});
it('check if org was added', async () => {
it('update org', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
"address": null,
"teams": []
});
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json")
@ -37,4 +36,30 @@ describe('adding + updating name', () => {
})
});
});
});
// ---------------
describe('adding + try updating id (should return 406)', () => {
let added_org_id
let added_org
describe('adding org', () => {
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
"name": "test123"
});
added_org = res1.data
added_org_id = added_org.id;
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
});
it('update org', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id + 1,
"name": "testlelele",
"contact": null,
"address": null,
}, { validateStatus: undefined });
expect(res2.status).toEqual(406);
expect(res2.headers['content-type']).toContain("application/json")
});
});
});