parent
e184673963
commit
9bc80aac8a
@ -1,5 +1,7 @@
|
|||||||
|
import { faker } from '@faker-js/faker';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { config } from '../../config';
|
import { config } from '../../config';
|
||||||
|
|
||||||
const base = "http://localhost:" + config.internal_port
|
const base = "http://localhost:" + config.internal_port
|
||||||
|
|
||||||
let access_token;
|
let access_token;
|
||||||
@ -21,7 +23,7 @@ describe('delete selfservice runner invalid', () => {
|
|||||||
const res = await axios.post(base + '/api/runners/register', {
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_runner = res.data;
|
added_runner = res.data;
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
@ -50,7 +52,7 @@ describe('delete selfservice runner valid', () => {
|
|||||||
const res = await axios.post(base + '/api/runners/register', {
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_runner = res.data;
|
added_runner = res.data;
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { faker } from '@faker-js/faker';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { config } from '../../config';
|
import { config } from '../../config';
|
||||||
const base = "http://localhost:" + config.internal_port
|
const base = "http://localhost:" + config.internal_port
|
||||||
@ -30,7 +31,7 @@ describe('register + get should return 200', () => {
|
|||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { faker } from '@faker-js/faker';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { config } from '../../config';
|
import { config } from '../../config';
|
||||||
const base = "http://localhost:" + config.internal_port
|
const base = "http://localhost:" + config.internal_port
|
||||||
@ -39,7 +40,7 @@ describe('register invalid citizen', () => {
|
|||||||
const res = await axios.post(base + '/api/runners/register', {
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
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");
|
||||||
@ -48,7 +49,7 @@ describe('register invalid citizen', () => {
|
|||||||
const res = await axios.post(base + '/api/runners/register', {
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
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");
|
||||||
@ -59,7 +60,26 @@ describe('register invalid citizen', () => {
|
|||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"phone": "peter",
|
"phone": "peter",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
|
}, axios_config);
|
||||||
|
expect(res.status).toEqual(400);
|
||||||
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
|
});
|
||||||
|
it('registering as citizen with duplicate mail should return 400', async () => {
|
||||||
|
const mail = faker.internet.exampleEmail();
|
||||||
|
await axios.post(base + '/api/runners/register', {
|
||||||
|
"firstname": "string",
|
||||||
|
"middlename": "string",
|
||||||
|
"lastname": "string",
|
||||||
|
"phone": "peter",
|
||||||
|
"email": mail,
|
||||||
|
}, axios_config);
|
||||||
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
|
"firstname": "string",
|
||||||
|
"middlename": "string",
|
||||||
|
"lastname": "string",
|
||||||
|
"phone": "peter",
|
||||||
|
"email": mail,
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
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");
|
||||||
@ -71,7 +91,7 @@ describe('register citizen valid', () => {
|
|||||||
const res = await axios.post(base + '/api/runners/register', {
|
const res = await axios.post(base + '/api/runners/register', {
|
||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com"
|
"email": faker.internet.exampleEmail(),
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
@ -81,7 +101,7 @@ describe('register citizen valid', () => {
|
|||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com",
|
"email": faker.internet.exampleEmail(),
|
||||||
"phone": "+4909132123456",
|
"phone": "+4909132123456",
|
||||||
"address": {
|
"address": {
|
||||||
address1: "Teststreet 1",
|
address1: "Teststreet 1",
|
||||||
@ -187,7 +207,7 @@ describe('register valid company', () => {
|
|||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com",
|
"email": faker.internet.exampleEmail(),
|
||||||
"phone": "+4909132123456",
|
"phone": "+4909132123456",
|
||||||
"address": {
|
"address": {
|
||||||
address1: "Teststreet 1",
|
address1: "Teststreet 1",
|
||||||
@ -214,7 +234,7 @@ describe('register valid company', () => {
|
|||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com",
|
"email": "faker.internet.exampleEmail(),
|
||||||
"phone": "+4909132123456",
|
"phone": "+4909132123456",
|
||||||
"address": {
|
"address": {
|
||||||
address1: "Teststreet 1",
|
address1: "Teststreet 1",
|
||||||
@ -232,7 +252,7 @@ describe('register valid company', () => {
|
|||||||
"firstname": "string",
|
"firstname": "string",
|
||||||
"middlename": "string",
|
"middlename": "string",
|
||||||
"lastname": "string",
|
"lastname": "string",
|
||||||
"email": "user@example.com",
|
"email": faker.internet.exampleEmail(),
|
||||||
"phone": "+4909132123456",
|
"phone": "+4909132123456",
|
||||||
"address": {
|
"address": {
|
||||||
address1: "Teststreet 1",
|
address1: "Teststreet 1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user