Changed organisation* to organization* in descriptions, comments and endoints ✏

ref #117
This commit is contained in:
Nicolai Ort 2021-01-24 18:34:15 +01:00
parent 5660aecb50
commit ef15d0d576
46 changed files with 145 additions and 145 deletions

View File

@ -36,7 +36,7 @@ export class ImportController {
return responseRunners;
}
@Post('/organisations/:id/import')
@Post('/organizations/:id/import')
@ContentType("application/json")
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })
@ResponseSchema(RunnerGroupNotFoundError, { statusCode: 404 })
@ -78,7 +78,7 @@ export class ImportController {
return await this.postJSON(importRunners, groupID);
}
@Post('/organisations/:id/import/csv')
@Post('/organizations/:id/import/csv')
@ContentType("application/json")
@UseBefore(RawBodyMiddleware)
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })

View File

@ -11,7 +11,7 @@ import { RunnerController } from './RunnerController';
import { RunnerTeamController } from './RunnerTeamController';
@JsonController('/organisations')
@JsonController('/organizations')
@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
export class RunnerOrganisationController {
private runnerOrganisationRepository: Repository<RunnerOrganisation>;
@ -26,7 +26,7 @@ export class RunnerOrganisationController {
@Get()
@Authorized("ORGANISATION:GET")
@ResponseSchema(ResponseRunnerOrganisation, { isArray: true })
@OpenAPI({ description: 'Lists all organisations. <br> This includes their address, contact and teams (if existing/associated).' })
@OpenAPI({ description: 'Lists all organizations. <br> This includes their address, contact and teams (if existing/associated).' })
async getAll() {
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
const runners = await this.runnerOrganisationRepository.find({ relations: ['contact', 'teams'] });
@ -41,7 +41,7 @@ export class RunnerOrganisationController {
@ResponseSchema(ResponseRunnerOrganisation)
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
@OnUndefined(RunnerOrganisationNotFoundError)
@OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' })
@OpenAPI({ description: 'Lists all information about the organization whose id got provided.' })
async getOne(@Param('id') id: number) {
let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['contact', 'teams'] });
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
@ -70,7 +70,7 @@ export class RunnerOrganisationController {
@ResponseSchema(ResponseRunnerOrganisation)
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
@ResponseSchema(RunnerOrganisationIdsNotMatchingError, { statusCode: 406 })
@OpenAPI({ description: "Update the organisation whose id you provided. <br> Please remember that ids can't be changed." })
@OpenAPI({ description: "Update the organization whose id you provided. <br> Please remember that ids can't be changed." })
async put(@Param('id') id: number, @Body({ validate: true }) updateOrganisation: UpdateRunnerOrganisation) {
let oldRunnerOrganisation = await this.runnerOrganisationRepository.findOne({ id: id });
@ -94,11 +94,11 @@ export class RunnerOrganisationController {
@ResponseSchema(RunnerOrganisationHasTeamsError, { statusCode: 406 })
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
@OnUndefined(204)
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organisation still has runners and/or teams associated this will fail. <br> To delete the organisation with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organisation with this id exists it will just return 204(no content).' })
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organization still has runners and/or teams associated this will fail. <br> To delete the organization with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organization with this id exists it will just return 204(no content).' })
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
let organisation = await this.runnerOrganisationRepository.findOne({ id: id });
if (!organisation) { return null; }
let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organisation, { relations: ['contact', 'runners', 'teams'] });
let organization = await this.runnerOrganisationRepository.findOne({ id: id });
if (!organization) { return null; }
let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organization, { relations: ['contact', 'runners', 'teams'] });
if (!force) {
if (runnerOrganisation.teams.length != 0) {
@ -121,7 +121,7 @@ export class RunnerOrganisationController {
}
const responseOrganisation = new ResponseRunnerOrganisation(runnerOrganisation);
await this.runnerOrganisationRepository.delete(organisation);
await this.runnerOrganisationRepository.delete(organization);
return responseOrganisation;
}
}

View File

@ -53,7 +53,7 @@ export class RunnerSelfServiceController {
@Post('/register/:token')
@ResponseSchema(ResponseSelfServiceRunner)
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
@OpenAPI({ description: 'Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organisations endpoint.' })
@OpenAPI({ description: 'Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organizations endpoint.' })
async registerOrganisationRunner(@Param('token') token: string, @Body({ validate: true }) createRunner: CreateSelfServiceRunner) {
const org = await this.getOrgansisation(token);
@ -85,14 +85,14 @@ export class RunnerSelfServiceController {
/**
* Get's a runner org by a provided registration api key.
* @param token The organisation's registration api token.
* @param token The organization's registration api token.
*/
private async getOrgansisation(token: string): Promise<RunnerGroup> {
token = Buffer.from(token, 'base64').toString('utf8');
const organisation = await this.orgRepository.findOne({ key: token });
if (!organisation) { throw new RunnerOrganisationNotFoundError; }
const organization = await this.orgRepository.findOne({ key: token });
if (!organization) { throw new RunnerOrganisationNotFoundError; }
return organisation;
return organization;
}
}

View File

@ -25,7 +25,7 @@ export class RunnerTeamController {
@Get()
@Authorized("TEAM:GET")
@ResponseSchema(ResponseRunnerTeam, { isArray: true })
@OpenAPI({ description: 'Lists all teams. <br> This includes their parent organisation and contact (if existing/associated).' })
@OpenAPI({ description: 'Lists all teams. <br> This includes their parent organization and contact (if existing/associated).' })
async getAll() {
let responseTeams: ResponseRunnerTeam[] = new Array<ResponseRunnerTeam>();
const runners = await this.runnerTeamRepository.find({ relations: ['parentGroup', 'contact'] });

View File

@ -94,10 +94,10 @@ export class StatsController {
return responseTeams;
}
@Get("/organisations/distance")
@Get("/organizations/distance")
@UseBefore(StatsAuth)
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
@OpenAPI({ description: "Returns the top ten organisations by distance.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
@OpenAPI({ description: "Returns the top ten organizations by distance.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async getTopOrgsByDistance() {
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
let topOrgs = orgs.sort((org1, org2) => org1.distance - org2.distance).slice(0, 9);
@ -108,10 +108,10 @@ export class StatsController {
return responseOrgs;
}
@Get("/organisations/donations")
@Get("/organizations/donations")
@UseBefore(StatsAuth)
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
@OpenAPI({ description: "Returns the top ten organisations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
@OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
async getTopOrgsByDonations() {
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
let topOrgs = orgs.sort((org1, org2) => org1.distanceDonationAmount - org2.distanceDonationAmount).slice(0, 9);

View File

@ -32,7 +32,7 @@ export class RunnerGroupNeededError extends NotAcceptableError {
name = "RunnerGroupNeededError"
@IsString()
message = "Runner's need to be part of one group (team or organisation)! \n You provided neither."
message = "Runner's need to be part of one group (team or organization)! \n You provided neither."
}
/**

View File

@ -2,7 +2,7 @@ import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
/**
* Error to throw when a runner organisation couldn't be found.
* Error to throw when a runner organization couldn't be found.
*/
export class RunnerOrganisationNotFoundError extends NotFoundError {
@IsString()
@ -13,37 +13,37 @@ export class RunnerOrganisationNotFoundError extends NotFoundError {
}
/**
* Error to throw when two runner organisation's ids don't match.
* Usually occurs when a user tries to change a runner organisation's id.
* Error to throw when two runner organization's ids don't match.
* Usually occurs when a user tries to change a runner organization's id.
*/
export class RunnerOrganisationIdsNotMatchingError extends NotAcceptableError {
@IsString()
name = "RunnerOrganisationIdsNotMatchingError"
@IsString()
message = "The ids don't match! \n And if you wanted to change a runner organisation's id: This isn't allowed!"
message = "The ids don't match! \n And if you wanted to change a runner organization's id: This isn't allowed!"
}
/**
* Error to throw when a organisation still has runners associated.
* Error to throw when a organization still has runners associated.
*/
export class RunnerOrganisationHasRunnersError extends NotAcceptableError {
@IsString()
name = "RunnerOrganisationHasRunnersError"
@IsString()
message = "This organisation still has runners associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
message = "This organization still has runners associated with it. \n If you want to delete this organization with all it's runners and teams add `?force` to your query."
}
/**
* Error to throw when a organisation still has teams associated.
* Error to throw when a organization still has teams associated.
*/
export class RunnerOrganisationHasTeamsError extends NotAcceptableError {
@IsString()
name = "RunnerOrganisationHasTeamsError"
@IsString()
message = "This organisation still has teams associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
message = "This organization still has teams associated with it. \n If you want to delete this organization with all it's runners and teams add `?force` to your query."
}
/**
@ -54,5 +54,5 @@ export class RunnerOrganisationWrongTypeError extends NotAcceptableError {
name = "RunnerOrganisationWrongTypeError"
@IsString()
message = "The runner organisation must be an existing organisation's id. \n You provided a object of another type."
message = "The runner organization must be an existing organization's id. \n You provided a object of another type."
}

View File

@ -43,5 +43,5 @@ export class RunnerTeamNeedsParentError extends NotAcceptableError {
name = "RunnerTeamNeedsParentError"
@IsString()
message = "You provided no runner organisation as this team's parent group."
message = "You provided no runner organization as this team's parent group."
}

View File

@ -10,14 +10,14 @@ import { CreateRunnerGroup } from './CreateRunnerGroup';
*/
export class CreateRunnerOrganisation extends CreateRunnerGroup {
/**
* The new organisation's address.
* The new organization's address.
*/
@IsOptional()
@IsObject()
address?: Address;
/**
* Is registration enabled for the new organisation?
* Is registration enabled for the new organization?
*/
@IsOptional()
@IsBoolean()

View File

@ -17,14 +17,14 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
id: number;
/**
* The updated organisation's address.
* The updated organization's address.
*/
@IsOptional()
@IsObject()
address?: Address;
/**
* Is registration enabled for the updated organisation?
* Is registration enabled for the updated organization?
*/
@IsOptional()
@IsBoolean()
@ -33,21 +33,21 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
/**
* Updates a provided RunnerOrganisation entity based on this.
*/
public async update(organisation: RunnerOrganisation): Promise<RunnerOrganisation> {
public async update(organization: RunnerOrganisation): Promise<RunnerOrganisation> {
organisation.name = this.name;
organisation.contact = await this.getContact();
if (!this.address) { organisation.address.reset(); }
else { organisation.address = this.address; }
Address.validate(organisation.address);
organization.name = this.name;
organization.contact = await this.getContact();
if (!this.address) { organization.address.reset(); }
else { organization.address = this.address; }
Address.validate(organization.address);
if (this.registrationEnabled && !organisation.key) {
organisation.key = uuid.v4().toUpperCase();
if (this.registrationEnabled && !organization.key) {
organization.key = uuid.v4().toUpperCase();
}
else {
organisation.key = null;
organization.key = null;
}
return organisation;
return organization;
}
}

View File

@ -16,7 +16,7 @@ import { Scan } from "./Scan";
export class Runner extends Participant {
/**
* The runner's associated group.
* Can be a runner team or organisation.
* Can be a runner team or organization.
*/
@IsNotEmpty()
@ManyToOne(() => RunnerGroup, group => group.runners)

View File

@ -14,21 +14,21 @@ import { RunnerTeam } from "./RunnerTeam";
export class RunnerOrganisation extends RunnerGroup {
/**
* The organisations's address.
* The organizations's address.
*/
@IsOptional()
@Column(type => Address)
address?: Address;
/**
* The organisation's teams.
* Used to link teams to a organisation.
* The organization's teams.
* Used to link teams to a organization.
*/
@OneToMany(() => RunnerTeam, team => team.parentGroup, { nullable: true })
teams: RunnerTeam[];
/**
* The organisation's api key for self-service registration.
* The organization's api key for self-service registration.
* The api key can be used for the /runners/register/:token endpoint.
* Is has to be base64 encoded if used via the api (to keep url-safety).
*/
@ -38,7 +38,7 @@ export class RunnerOrganisation extends RunnerGroup {
key?: string;
/**
* Returns all runners associated with this organisation (directly or indirectly via teams).
* Returns all runners associated with this organization (directly or indirectly via teams).
*/
public get allRunners(): Runner[] {
let returnRunners: Runner[] = new Array<Runner>();

View File

@ -33,7 +33,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup {
teams: RunnerTeam[];
/**
* The organisation's registration key.
* The organization's registration key.
* If registration is disabled this is null.
*/
@IsString()
@ -42,7 +42,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup {
registrationKey?: string;
/**
* Is registration enabled for the organisation?
* Is registration enabled for the organization?
*/
@IsOptional()
@IsBoolean()

View File

@ -9,7 +9,7 @@ import { ResponseRunnerOrganisation } from './ResponseRunnerOrganisation';
export class ResponseRunnerTeam extends ResponseRunnerGroup {
/**
* The runnerTeam's parent group (organisation).
* The runnerTeam's parent group (organization).
*/
@IsObject()
@IsNotEmpty()

View File

@ -26,7 +26,7 @@ export class ResponseStats {
total_teams: number;
/**
* The amount of organisations registered in the system.
* The amount of organizations registered in the system.
*/
@IsInt()
total_orgs: number;

View File

@ -35,8 +35,8 @@ export class ResponseStatsOrgnisation {
donationAmount: number;
/**
* Creates a new organisation stats response from a organisation
* @param org The organisation whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track, teams, teams.runners, teams.runners.scans, teams.runners.distanceDonations, teams.runners.scans.track
* Creates a new organization stats response from a organization
* @param org The organization whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track, teams, teams.runners, teams.runners.scans, teams.runners.distanceDonations, teams.runners.scans.track
*/
public constructor(org: RunnerOrganisation) {
this.name = org.name;

View File

@ -69,7 +69,7 @@ describe('POST /api/cards successfully (with runner)', () => {
let added_org;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -50,7 +50,7 @@ describe('adding + updating card.runner successfully', () => {
let added_runner2;
let added_card;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -108,7 +108,7 @@ describe('POST /api/contacts working (with group)', () => {
let added_team;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;

View File

@ -50,7 +50,7 @@ describe('add+delete (with org)', () => {
let added_org;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;
@ -88,7 +88,7 @@ describe('add+delete (with team)', () => {
let added_team;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;
@ -137,7 +137,7 @@ describe('add+delete (with org&team)', () => {
let added_team;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;

View File

@ -59,7 +59,7 @@ describe('Update contact group after adding (should work)', () => {
let added_team;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;
@ -189,7 +189,7 @@ describe('Update contact group invalid after adding (should fail)', () => {
let added_org;
let added_contact;
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res.data.contact;

View File

@ -83,7 +83,7 @@ describe('POST /api/donations/distance illegally', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -199,7 +199,7 @@ describe('POST /api/donations/distance successfully', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -70,7 +70,7 @@ describe('DELETE distance donation', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -73,7 +73,7 @@ describe('adding + getting distance donation', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -84,7 +84,7 @@ describe('adding + updating distance donation illegally', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -253,7 +253,7 @@ describe('adding + updating distance donation valid', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -60,7 +60,7 @@ describe('DELETE donor with donations invalid', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -115,7 +115,7 @@ describe('DELETE donor with donations valid', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -14,24 +14,24 @@ beforeAll(async () => {
};
});
describe('GET /api/organisations', () => {
describe('GET /api/organizations', () => {
it('basic get should return 200', async () => {
const res = await axios.get(base + '/api/organisations', axios_config);
const res = await axios.get(base + '/api/organizations', axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
});
// ---------------
describe('POST /api/organisations', () => {
describe('POST /api/organizations', () => {
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with without a name should return 400', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": null
}, axios_config);
expect(res.status).toEqual(400);
@ -41,14 +41,14 @@ describe('POST /api/organisations', () => {
// ---------------
describe('adding + getting from all orgs', () => {
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
it('check if org was added', async () => {
const res = await axios.get(base + '/api/organisations', axios_config);
const res = await axios.get(base + '/api/organizations', axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
let added_org = res.data[res.data.length - 1]
@ -72,7 +72,7 @@ describe('adding + getting from all orgs', () => {
describe('adding + getting explicitly', () => {
let added_org_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data
@ -81,7 +81,7 @@ describe('adding + getting explicitly', () => {
expect(res1.headers['content-type']).toContain("application/json")
});
it('check if org was added', async () => {
const res2 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
const res2 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json")
let added_org2 = res2.data

View File

@ -17,7 +17,7 @@ beforeAll(async () => {
// ---------------
describe('adding + deletion (non-existant)', () => {
it('delete', async () => {
const res2 = await axios.delete(base + '/api/organisations/0', axios_config);
const res2 = await axios.delete(base + '/api/organizations/0', axios_config);
expect(res2.status).toEqual(204);
});
});
@ -26,7 +26,7 @@ describe('adding + deletion (successfull)', () => {
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', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -35,7 +35,7 @@ describe('adding + deletion (successfull)', () => {
expect(res1.headers['content-type']).toContain("application/json")
});
it('delete', async () => {
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id, axios_config);
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id, axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json")
let added_org2 = res2.data
@ -56,7 +56,7 @@ describe('adding + deletion (successfull)', () => {
});
});
it('check if org really was deleted', async () => {
const res3 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
const res3 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
expect(res3.status).toEqual(404);
expect(res3.headers['content-type']).toContain("application/json")
});
@ -68,7 +68,7 @@ describe('adding + deletion with teams still existing (without force)', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;
@ -87,7 +87,7 @@ describe('adding + deletion with teams still existing (without force)', () => {
expect(res2.headers['content-type']).toContain("application/json")
});
it('delete org - this should fail with a 406', async () => {
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id, axios_config);
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id, axios_config);
expect(res2.status).toEqual(406);
expect(res2.headers['content-type']).toContain("application/json")
});
@ -99,7 +99,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;
@ -118,7 +118,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
expect(res2.headers['content-type']).toContain("application/json")
});
it('delete', async () => {
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id + '?force=true', axios_config);
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id + '?force=true', axios_config);
expect(res2.status).toEqual(200);
expect(res2.headers['content-type']).toContain("application/json")
let added_org2 = res2.data
@ -139,7 +139,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
});
});
it('check if org really was deleted', async () => {
const res3 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
const res3 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
expect(res3.status).toEqual(404);
expect(res3.headers['content-type']).toContain("application/json")
});

View File

@ -14,15 +14,15 @@ beforeAll(async () => {
};
});
describe('GET /api/organisations', () => {
describe('GET /api/organizations', () => {
it('basic get should return 200', async () => {
const res = await axios.get(base + '/api/organisations', axios_config);
const res = await axios.get(base + '/api/organizations', axios_config);
expect(res.status).toEqual(200);
expect(res.headers['content-type']).toContain("application/json")
});
});
// ---------------
describe('GET /api/organisations/0', () => {
describe('GET /api/organizations/0', () => {
it('basic get should return 404', async () => {
const res = await axios.get(base + '/api/runners/0', axios_config);
expect(res.status).toEqual(404);

View File

@ -19,7 +19,7 @@ describe('adding + updating name', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -28,7 +28,7 @@ describe('adding + updating name', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('update org', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -59,7 +59,7 @@ describe('adding + try updating id (should return 406)', () => {
let added_org_id
let added_org
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -68,7 +68,7 @@ describe('adding + try updating id (should return 406)', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('update org', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id + 1,
"name": "testlelele",
"contact": null,
@ -83,7 +83,7 @@ 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 res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -92,7 +92,7 @@ describe('adding + updateing address valid)', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('adding address to org should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -122,7 +122,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s first line should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -152,7 +152,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s second line should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -182,7 +182,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s city should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -212,7 +212,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s country should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -242,7 +242,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('updateing address\'s postal code should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -272,7 +272,7 @@ describe('adding + updateing address valid)', () => {
});
});
it('removing org\'s address should return 200', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -300,7 +300,7 @@ 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 res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -309,7 +309,7 @@ describe('adding + updateing address invalid)', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('adding address to org w/o address1 should return 400', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -325,7 +325,7 @@ describe('adding + updateing address invalid)', () => {
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o city should return 400', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -341,7 +341,7 @@ describe('adding + updateing address invalid)', () => {
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o country should return 400', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -357,7 +357,7 @@ describe('adding + updateing address invalid)', () => {
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/o postal code should return 400', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,
@ -373,7 +373,7 @@ describe('adding + updateing address invalid)', () => {
expect(res.headers['content-type']).toContain("application/json");
});
it('adding address to org w/ invalid postal code should return 400', async () => {
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
"id": added_org_id,
"name": "testlelele",
"contact": null,

View File

@ -58,7 +58,7 @@ describe('POST /api/teams with errors', () => {
describe('POST /api/teams working', () => {
let added_org_id;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data

View File

@ -21,7 +21,7 @@ describe('adding org', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;

View File

@ -20,7 +20,7 @@ describe('adding + updating name', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;
@ -59,7 +59,7 @@ describe('adding + try updating id (should return 406)', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;
@ -92,7 +92,7 @@ describe('add+update parent org (valid)', () => {
let added_team;
let added_team_id
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data;
@ -110,7 +110,7 @@ describe('add+update parent org (valid)', () => {
expect(res2.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res3 = await axios.post(base + '/api/organisations', {
const res3 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org2 = res3.data;

View File

@ -80,7 +80,7 @@ describe('POST /api/runners with errors', () => {
describe('POST /api/runners working', () => {
let added_org_id;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data

View File

@ -25,7 +25,7 @@ describe('add+delete', () => {
let added_org_id;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data
@ -71,7 +71,7 @@ describe('DELETE donor with donations invalid', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data
@ -118,7 +118,7 @@ describe('DELETE donor with donations valid', () => {
expect(res.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res = await axios.post(base + '/api/organisations', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res.data

View File

@ -33,7 +33,7 @@ describe('GET /api/runners after adding', () => {
let added_org_id;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data

View File

@ -18,7 +18,7 @@ describe('Update runner name after adding', () => {
let added_org;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
delete res1.data.registrationEnabled;
@ -58,7 +58,7 @@ describe('Update runner group after adding', () => {
let added_org_2;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data
@ -77,7 +77,7 @@ describe('Update runner group after adding', () => {
expect(res2.headers['content-type']).toContain("application/json")
});
it('creating a new org with just a name should return 200', async () => {
const res3 = await axios.post(base + '/api/organisations', {
const res3 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org_2 = res3.data
@ -103,7 +103,7 @@ describe('Update runner id after adding(should fail)', () => {
let added_runner;
let added_runner_id;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
let added_org = res1.data
@ -135,7 +135,7 @@ describe('Update runner group with invalid group after adding', () => {
let added_org;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -19,7 +19,7 @@ describe('POST /api/scans illegally', () => {
let added_org;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -70,7 +70,7 @@ describe('POST /api/scans successfully', () => {
let added_org;
let added_runner;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -144,7 +144,7 @@ describe('POST /api/scans successfully via scan station', () => {
let added_track;
let added_station;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -21,7 +21,7 @@ describe('DELETE scan', () => {
let added_runner;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -35,7 +35,7 @@ describe('adding + getting scans', () => {
let added_runner;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -19,7 +19,7 @@ describe('adding + updating illegally', () => {
let added_runner;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -86,7 +86,7 @@ describe('adding + updating successfilly', () => {
let added_runner2;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -98,7 +98,7 @@ describe('register citizen valid', () => {
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', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123",
"registrationEnabled": true
}, axios_config);
@ -156,7 +156,7 @@ 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', {
const res = await axios.post(base + '/api/organizations', {
"name": "test123",
"registrationEnabled": true
}, axios_config);

View File

@ -22,7 +22,7 @@ describe('POST /api/scans illegally', () => {
let added_track;
let added_station;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -109,7 +109,7 @@ describe('POST /api/scans successfully', () => {
let added_track;
let added_station;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -179,7 +179,7 @@ describe('POST /api/scans successfully via scan station', () => {
let added_track;
let added_station;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -24,7 +24,7 @@ describe('DELETE scan', () => {
let added_station;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -38,7 +38,7 @@ describe('adding + getting scans', () => {
let added_station;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data

View File

@ -22,7 +22,7 @@ describe('adding + updating illegally', () => {
let added_station;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data
@ -123,7 +123,7 @@ describe('adding + updating successfilly', () => {
let added_station2;
let added_scan;
it('creating a new org with just a name should return 200', async () => {
const res1 = await axios.post(base + '/api/organisations', {
const res1 = await axios.post(base + '/api/organizations', {
"name": "test123"
}, axios_config);
added_org = res1.data