@@ -116,7 +116,7 @@ describe('register invalid company', () => {
 | 
				
			|||||||
        expect(res.headers['content-type']).toContain("application/json");
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    it('registering without firstname should return 400', async () => {
 | 
					    it('registering without firstname should return 400', async () => {
 | 
				
			||||||
        const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
            "middlename": "string",
 | 
					            "middlename": "string",
 | 
				
			||||||
            "lastname": "string",
 | 
					            "lastname": "string",
 | 
				
			||||||
        }, axios_config);
 | 
					        }, axios_config);
 | 
				
			||||||
@@ -124,7 +124,7 @@ describe('register invalid company', () => {
 | 
				
			|||||||
        expect(res.headers['content-type']).toContain("application/json");
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    it('registering without lastname should return 400', async () => {
 | 
					    it('registering without lastname should return 400', async () => {
 | 
				
			||||||
        const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
            "middlename": "string",
 | 
					            "middlename": "string",
 | 
				
			||||||
            "firstname": "string",
 | 
					            "firstname": "string",
 | 
				
			||||||
        }, axios_config);
 | 
					        }, axios_config);
 | 
				
			||||||
@@ -132,7 +132,7 @@ describe('register invalid company', () => {
 | 
				
			|||||||
        expect(res.headers['content-type']).toContain("application/json");
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    it('registering with bs mail should return 400', async () => {
 | 
					    it('registering with bs mail should return 400', async () => {
 | 
				
			||||||
        const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
            "firstname": "string",
 | 
					            "firstname": "string",
 | 
				
			||||||
            "middlename": "string",
 | 
					            "middlename": "string",
 | 
				
			||||||
            "lastname": "string",
 | 
					            "lastname": "string",
 | 
				
			||||||
@@ -141,4 +141,99 @@ describe('register invalid company', () => {
 | 
				
			|||||||
        expect(res.status).toEqual(400);
 | 
					        expect(res.status).toEqual(400);
 | 
				
			||||||
        expect(res.headers['content-type']).toContain("application/json");
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					// ---------------
 | 
				
			||||||
 | 
					describe('register valid company', () => {
 | 
				
			||||||
 | 
					    let added_org;
 | 
				
			||||||
 | 
					    let added_team;
 | 
				
			||||||
 | 
					    it('creating a new org with just a name and registration enabled should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/organisations', {
 | 
				
			||||||
 | 
					            "name": "test123",
 | 
				
			||||||
 | 
					            "registrationEnabled": true
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        added_org = res.data;
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json")
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('creating a new team with a parent org should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/teams', {
 | 
				
			||||||
 | 
					            "name": "test_team",
 | 
				
			||||||
 | 
					            "parentGroup": added_org.id
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        added_team = res.data;
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json")
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('registering with minimal params should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
 | 
					            "firstname": "string",
 | 
				
			||||||
 | 
					            "lastname": "string",
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('registering with all params except team should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
 | 
					            "firstname": "string",
 | 
				
			||||||
 | 
					            "middlename": "string",
 | 
				
			||||||
 | 
					            "lastname": "string",
 | 
				
			||||||
 | 
					            "email": "user@example.com",
 | 
				
			||||||
 | 
					            "phone": "+4909132123456",
 | 
				
			||||||
 | 
					            "address": {
 | 
				
			||||||
 | 
					                address1: "Teststreet 1",
 | 
				
			||||||
 | 
					                address2: "Testapartement",
 | 
				
			||||||
 | 
					                postalcode: "91074",
 | 
				
			||||||
 | 
					                city: "Herzo",
 | 
				
			||||||
 | 
					                country: "Germany"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('registering with minimal params and team should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
 | 
					            "firstname": "string",
 | 
				
			||||||
 | 
					            "lastname": "string",
 | 
				
			||||||
 | 
					            "team": added_team.id
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('registering with all params except team should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
 | 
					            "firstname": "string",
 | 
				
			||||||
 | 
					            "middlename": "string",
 | 
				
			||||||
 | 
					            "lastname": "string",
 | 
				
			||||||
 | 
					            "email": "user@example.com",
 | 
				
			||||||
 | 
					            "phone": "+4909132123456",
 | 
				
			||||||
 | 
					            "address": {
 | 
				
			||||||
 | 
					                address1: "Teststreet 1",
 | 
				
			||||||
 | 
					                address2: "Testapartement",
 | 
				
			||||||
 | 
					                postalcode: "91074",
 | 
				
			||||||
 | 
					                city: "Herzo",
 | 
				
			||||||
 | 
					                country: "Germany"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    it('registering with all params and team should return 200', async () => {
 | 
				
			||||||
 | 
					        const res = await axios.post(base + '/api/runners/register/' + added_org.registrationKey, {
 | 
				
			||||||
 | 
					            "firstname": "string",
 | 
				
			||||||
 | 
					            "middlename": "string",
 | 
				
			||||||
 | 
					            "lastname": "string",
 | 
				
			||||||
 | 
					            "email": "user@example.com",
 | 
				
			||||||
 | 
					            "phone": "+4909132123456",
 | 
				
			||||||
 | 
					            "address": {
 | 
				
			||||||
 | 
					                address1: "Teststreet 1",
 | 
				
			||||||
 | 
					                address2: "Testapartement",
 | 
				
			||||||
 | 
					                postalcode: "91074",
 | 
				
			||||||
 | 
					                city: "Herzo",
 | 
				
			||||||
 | 
					                country: "Germany"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "team": added_team.id
 | 
				
			||||||
 | 
					        }, axios_config);
 | 
				
			||||||
 | 
					        expect(res.status).toEqual(200);
 | 
				
			||||||
 | 
					        expect(res.headers['content-type']).toContain("application/json");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
		Reference in New Issue
	
	Block a user