Switched tests over to the new id-only schema
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #90
This commit is contained in:
parent
420e9c4662
commit
d88fb18319
|
@ -34,7 +34,7 @@ describe('POST /api/donors with errors', () => {
|
|||
"firstname": "first",
|
||||
"middlename": "middle",
|
||||
"lastname": "last",
|
||||
"address": 0
|
||||
"address": 99999999999999999999999999
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(404);
|
||||
expect(res2.headers['content-type']).toContain("application/json")
|
||||
|
|
|
@ -43,7 +43,7 @@ describe('adding + updating name', () => {
|
|||
"id": added_team_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"parentGroup": added_org
|
||||
"parentGroup": added_org.id
|
||||
}, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -79,6 +79,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||
});
|
||||
it('update team', async () => {
|
||||
added_team.id = added_team.id + 1;
|
||||
added_team.parentGroup = added_team.parentGroup.id;
|
||||
const res3 = await axios.put(base + '/api/teams/' + added_team_id, added_team, axios_config);
|
||||
expect(res3.status).toEqual(406);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -117,7 +118,7 @@ describe('add+update parent org (valid)', () => {
|
|||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('update team', async () => {
|
||||
added_team.parentGroup = added_org2;
|
||||
added_team.parentGroup = added_org2.id;
|
||||
const res4 = await axios.put(base + '/api/teams/' + added_team_id, added_team, axios_config);
|
||||
let updated_team = res4.data;
|
||||
expect(res4.status).toEqual(200);
|
||||
|
@ -125,6 +126,6 @@ describe('add+update parent org (valid)', () => {
|
|||
delete added_org2.address;
|
||||
delete added_org2.contact;
|
||||
delete added_org2.teams;
|
||||
expect(updated_team).toEqual(added_team)
|
||||
expect(updated_team.parentGroup).toEqual(added_org2)
|
||||
});
|
||||
});
|
|
@ -15,15 +15,14 @@ beforeAll(async () => {
|
|||
});
|
||||
|
||||
describe('Update runner name after adding', () => {
|
||||
let added_org_id;
|
||||
let added_org;
|
||||
let added_runner;
|
||||
let updated_runner;
|
||||
it('creating a new org with just a name should return 200', async () => {
|
||||
const res1 = await axios.post(base + '/api/organisations', {
|
||||
"name": "test123"
|
||||
}, axios_config);
|
||||
let added_org = res1.data
|
||||
added_org_id = added_org.id;
|
||||
added_org = res1.data
|
||||
expect(res1.status).toEqual(200);
|
||||
expect(res1.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
|
@ -31,7 +30,7 @@ describe('Update runner name after adding', () => {
|
|||
const res2 = await axios.post(base + '/api/runners', {
|
||||
"firstname": "first",
|
||||
"lastname": "last",
|
||||
"group": added_org_id
|
||||
"group": added_org.id
|
||||
}, axios_config);
|
||||
added_runner = res2.data;
|
||||
expect(res2.status).toEqual(200);
|
||||
|
@ -40,10 +39,15 @@ describe('Update runner name after adding', () => {
|
|||
it('valid update should return 200', async () => {
|
||||
let runnercopy = added_runner
|
||||
runnercopy.firstname = "second"
|
||||
runnercopy.group = added_runner.group.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, runnercopy, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
updated_runner = res3.data
|
||||
updated_runner = res3.data;
|
||||
delete added_org.address;
|
||||
delete added_org.contact;
|
||||
delete added_org.teams;
|
||||
runnercopy.group = added_org;
|
||||
expect(updated_runner).toEqual(runnercopy);
|
||||
});
|
||||
});
|
||||
|
@ -83,13 +87,13 @@ describe('Update runner group after adding', () => {
|
|||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('valid update should return 200', async () => {
|
||||
added_runner.group = added_org_2;
|
||||
it('valid group update should return 200', async () => {
|
||||
added_runner.group = added_org_2.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
updated_runner = res3.data
|
||||
expect(updated_runner).toEqual(added_runner);
|
||||
expect(updated_runner.group).toEqual(added_org_2);
|
||||
});
|
||||
});
|
||||
// ---------------
|
||||
|
@ -119,6 +123,7 @@ describe('Update runner id after adding(should fail)', () => {
|
|||
});
|
||||
it('invalid update should return 406', async () => {
|
||||
added_runner.id++;
|
||||
added_runner.group = added_runner.group.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner_id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(406);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -146,9 +151,8 @@ describe('Update runner group with invalid group after adding', () => {
|
|||
expect(res2.status).toEqual(200);
|
||||
expect(res2.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('invalid update should return 404', async () => {
|
||||
added_org.id = 0;
|
||||
added_runner.group = added_org;
|
||||
it('invalid group update should return 404', async () => {
|
||||
added_runner.group = 99999999999999999;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(404);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
|
Loading…
Reference in New Issue