Added registration invalid company tests

ref #112
This commit is contained in:
Nicolai Ort 2021-01-21 19:34:11 +01:00
parent 72941da1cb
commit 29aeb046de
1 changed files with 48 additions and 0 deletions

View File

@ -94,3 +94,51 @@ describe('register citizen valid', () => {
expect(res.headers['content-type']).toContain("application/json");
});
});
// ---------------
describe('register invalid company', () => {
let added_org;
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('registering with bs token should return 404', async () => {
const res = await axios.post(base + '/api/runners/register/4040404', {
"firstname": "string",
"middlename": "string",
"lastname": "string",
}, axios_config);
expect(res.status).toEqual(404);
expect(res.headers['content-type']).toContain("application/json");
});
it('registering without firstname should return 400', async () => {
const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
"middlename": "string",
"lastname": "string",
}, axios_config);
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('registering without lastname should return 400', async () => {
const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
"middlename": "string",
"firstname": "string",
}, axios_config);
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
it('registering with bs mail should return 400', async () => {
const res = await axios.post(base + '/api/runners/register/' + added_org.token, {
"firstname": "string",
"middlename": "string",
"lastname": "string",
"email": "true"
}, axios_config);
expect(res.status).toEqual(400);
expect(res.headers['content-type']).toContain("application/json");
});
});