Cleaned up var names
continuous-integration/drone/pr Build is failing Details

ref #105
This commit is contained in:
Nicolai Ort 2021-01-19 15:48:06 +01:00
parent 427dfaafab
commit a3c93f0d39
1 changed files with 68 additions and 68 deletions

View File

@ -19,24 +19,24 @@ describe('adding + updating name', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organisations', {
"name": "test123"
}, axios_config);
added_org = res1.data
added_org = res.data
added_org_id = added_org.id;
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('update org', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
"address": null,
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json")
let added_org2 = res2.data
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
let added_org2 = res.data
added_org_id = added_org2.id;
delete added_org2.id
expect(added_org2).toEqual({
@ -58,23 +58,23 @@ describe('adding + try updating id (should return 406)', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organisations', {
"name": "test123"
}, axios_config);
added_org = res1.data
added_org = res.data
added_org_id = added_org.id;
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('update org', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id + 1,
"name": "testlelele",
"contact": null,
"address": null,
}, axios_config);
expect(res2.status).toEqual(406);
expect(res2.headers['content-type']).toContain("application/json")
expect(res.status).toEqual(406);
expect(res.headers['content-type']).toContain("application/json")
});
});
// ---------------
@ -82,37 +82,37 @@ describe('adding + updateing address valid)', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organisations', {
"name": "test123"
}, axios_config);
added_org = res1.data
added_org = res.data
added_org_id = added_org.id;
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('adding address to org should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
"address": {
"address1": "Test1",
"address2": null,
"city": "TestCity",
"city": "Herzogenaurach",
"country": "Burkina Faso",
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
"address": {
"address1": "Test1",
"address2": null,
"city": "TestCity",
"city": "Herzogenaurach",
"country": "Burkina Faso",
"postalcode": "90174"
},
@ -120,7 +120,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s first line should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -132,9 +132,9 @@ describe('adding + updateing address valid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -149,7 +149,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s second line should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -161,9 +161,9 @@ describe('adding + updateing address valid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -178,7 +178,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s city should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -190,9 +190,9 @@ describe('adding + updateing address valid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -207,7 +207,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s country should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -219,9 +219,9 @@ describe('adding + updateing address valid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -236,7 +236,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s postal code should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -248,9 +248,9 @@ describe('adding + updateing address valid)', () => {
"postalcode": "91065"
}
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -265,14 +265,14 @@ describe('adding + updateing address valid)', () => {
});
});
it('removing org\'s should return 200', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null
}, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json");
expect(res2.data).toEqual({
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json");
expect(res.data).toEqual({
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -292,16 +292,16 @@ describe('adding + updateing address invalid)', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organisations', {
"name": "test123"
}, axios_config);
added_org = res1.data
added_org = res.data
added_org_id = added_org.id;
expect(res1.status).toEqual(200);
expect(res1.headers['content-type']).toContain("application/json")
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('adding address to org w/o address1 should return 400', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -313,11 +313,11 @@ describe('adding + updateing address invalid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(400);
expect(res2.headers['content-type']).toContain("application/json");
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o city should return 400', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -329,11 +329,11 @@ describe('adding + updateing address invalid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(400);
expect(res2.headers['content-type']).toContain("application/json");
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o country should return 400', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -345,11 +345,11 @@ describe('adding + updateing address invalid)', () => {
"postalcode": "90174"
}
}, axios_config);
expect(res2.status).toEqual(400);
expect(res2.headers['content-type']).toContain("application/json");
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o postal code should return 400', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -361,11 +361,11 @@ describe('adding + updateing address invalid)', () => {
"postalcode": null
}
}, axios_config);
expect(res2.status).toEqual(400);
expect(res2.headers['content-type']).toContain("application/json");
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/ invalid postal code should return 400', async () => {
const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -377,7 +377,7 @@ describe('adding + updateing address invalid)', () => {
"postalcode": "-1"
}
}, axios_config);
expect(res2.status).toEqual(400);
expect(res2.headers['content-type']).toContain("application/json");
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
});