@@ -76,4 +76,105 @@ describe('adding + try updating id (should return 406)', () => {
 | 
			
		||||
        expect(res2.status).toEqual(406);
 | 
			
		||||
        expect(res2.headers['content-type']).toContain("application/json")
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
// ---------------
 | 
			
		||||
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', {
 | 
			
		||||
            "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 should return 200', 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": "90174"
 | 
			
		||||
            }
 | 
			
		||||
        }, 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": "Test1",
 | 
			
		||||
                "address2": null,
 | 
			
		||||
                "city": "TestCity",
 | 
			
		||||
                "country": "Burkina Faso",
 | 
			
		||||
                "postalcode": "90174"
 | 
			
		||||
            },
 | 
			
		||||
            "teams": []
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    it('updateing address\'s first line should return 200', async () => {
 | 
			
		||||
        const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
 | 
			
		||||
            "id": added_org_id,
 | 
			
		||||
            "name": "testlelele",
 | 
			
		||||
            "contact": null,
 | 
			
		||||
            "address": {
 | 
			
		||||
                "address1": "Test2",
 | 
			
		||||
                "address2": null,
 | 
			
		||||
                "city": "TestCity",
 | 
			
		||||
                "country": "Burkina Faso",
 | 
			
		||||
                "postalcode": "90174"
 | 
			
		||||
            }
 | 
			
		||||
        }, 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": "Test2",
 | 
			
		||||
                "address2": null,
 | 
			
		||||
                "city": "TestCity",
 | 
			
		||||
                "country": "Burkina Faso",
 | 
			
		||||
                "postalcode": "90174"
 | 
			
		||||
            },
 | 
			
		||||
            "teams": []
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    it('updateing address\'s second line should return 200', async () => {
 | 
			
		||||
        const res2 = await axios.put(base + '/api/organisations/' + added_org_id, {
 | 
			
		||||
            "id": added_org_id,
 | 
			
		||||
            "name": "testlelele",
 | 
			
		||||
            "contact": null,
 | 
			
		||||
            "address": {
 | 
			
		||||
                "address1": "Test2",
 | 
			
		||||
                "address2": "Test3",
 | 
			
		||||
                "city": "TestCity",
 | 
			
		||||
                "country": "Burkina Faso",
 | 
			
		||||
                "postalcode": "90174"
 | 
			
		||||
            }
 | 
			
		||||
        }, 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": "Test2",
 | 
			
		||||
                "address2": "Test3",
 | 
			
		||||
                "city": "TestCity",
 | 
			
		||||
                "country": "Burkina Faso",
 | 
			
		||||
                "postalcode": "90174"
 | 
			
		||||
            },
 | 
			
		||||
            "teams": []
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user