Added address update ivalid tests
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
ref #105
This commit is contained in:
parent
ae589aeb54
commit
427dfaafab
|
@ -264,4 +264,120 @@ describe('adding + updateing address valid)', () => {
|
|||
"teams": []
|
||||
});
|
||||
});
|
||||
it('removing org\'s should return 200', async () => {
|
||||
const res2 = 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({
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": null,
|
||||
"address2": null,
|
||||
"city": null,
|
||||
"country": null,
|
||||
"postalcode": null
|
||||
},
|
||||
"teams": []
|
||||
});
|
||||
});
|
||||
});
|
||||
// ---------------
|
||||
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', {
|
||||
"name": "test123"
|
||||
}, axios_config);
|
||||
added_org = res1.data
|
||||
added_org_id = added_org.id;
|
||||
expect(res1.status).toEqual(200);
|
||||
expect(res1.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, {
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": null,
|
||||
"address2": null,
|
||||
"city": "TestCity",
|
||||
"country": "Burkina Faso",
|
||||
"postalcode": "90174"
|
||||
}
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(400);
|
||||
expect(res2.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, {
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": "Test1",
|
||||
"address2": null,
|
||||
"city": null,
|
||||
"country": "Burkina Faso",
|
||||
"postalcode": "90174"
|
||||
}
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(400);
|
||||
expect(res2.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, {
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": "Test1",
|
||||
"address2": null,
|
||||
"city": "TestCity",
|
||||
"country": null,
|
||||
"postalcode": "90174"
|
||||
}
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(400);
|
||||
expect(res2.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, {
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": "Test1",
|
||||
"address2": null,
|
||||
"city": "TestCity",
|
||||
"country": "Burkina Faso",
|
||||
"postalcode": null
|
||||
}
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(400);
|
||||
expect(res2.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, {
|
||||
"id": added_org_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"address": {
|
||||
"address1": "Test1",
|
||||
"address2": null,
|
||||
"city": "TestCity",
|
||||
"country": "Burkina Faso",
|
||||
"postalcode": "-1"
|
||||
}
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(400);
|
||||
expect(res2.headers['content-type']).toContain("application/json");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue