From 599296c4e3736bf9aadbc32067cd2ff8c39f0f17 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 2 Jan 2021 19:01:55 +0100 Subject: [PATCH] Removed addresses from tests until the circular dependencies are solved ref #65 --- src/controllers/RunnerOrganisationController.ts | 10 +++++----- src/tests/runnerOrgs/org_add.spec.ts | 4 ++-- src/tests/runnerOrgs/org_delete.spec.ts | 4 ++-- src/tests/runnerOrgs/org_update.spec.ts | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/RunnerOrganisationController.ts b/src/controllers/RunnerOrganisationController.ts index e10d415..be25805 100644 --- a/src/controllers/RunnerOrganisationController.ts +++ b/src/controllers/RunnerOrganisationController.ts @@ -29,7 +29,7 @@ export class RunnerOrganisationController { @OpenAPI({ description: 'Lists all organisations.
This includes their address, contact and teams (if existing/associated).' }) async getAll() { let responseTeams: ResponseRunnerOrganisation[] = new Array(); - const runners = await this.runnerOrganisationRepository.find({ relations: ['address', 'contact', 'teams'] }); + const runners = await this.runnerOrganisationRepository.find({ relations: [/*'address',*/ 'contact', 'teams'] }); runners.forEach(runner => { responseTeams.push(new ResponseRunnerOrganisation(runner)); }); @@ -43,7 +43,7 @@ export class RunnerOrganisationController { @OnUndefined(RunnerOrganisationNotFoundError) @OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' }) async getOne(@Param('id') id: number) { - let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['address', 'contact', 'teams'] }); + let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: [/*'address',*/ 'contact', 'teams'] }); if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); } return new ResponseRunnerOrganisation(runnerOrg); } @@ -62,7 +62,7 @@ export class RunnerOrganisationController { runnerOrganisation = await this.runnerOrganisationRepository.save(runnerOrganisation); - return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne(runnerOrganisation, { relations: ['address', 'contact', 'teams'] })); + return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne(runnerOrganisation, { relations: [/*'address',*/ 'contact', 'teams'] })); } @Put('/:id') @@ -84,7 +84,7 @@ export class RunnerOrganisationController { await this.runnerOrganisationRepository.save(await updateOrganisation.updateRunnerOrganisation(oldRunnerOrganisation)); - return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne(id, { relations: ['address', 'contact', 'teams'] })); + return new ResponseRunnerOrganisation(await this.runnerOrganisationRepository.findOne(id, { relations: [/*'address',*/ 'contact', 'teams'] })); } @Delete('/:id') @@ -98,7 +98,7 @@ export class RunnerOrganisationController { 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: ['address', 'contact', 'runners', 'teams'] }); + let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organisation, { relations: [/*'address',*/ 'contact', 'runners', 'teams'] }); if (!force) { if (runnerOrganisation.teams.length != 0) { diff --git a/src/tests/runnerOrgs/org_add.spec.ts b/src/tests/runnerOrgs/org_add.spec.ts index 6ee0606..62aa067 100644 --- a/src/tests/runnerOrgs/org_add.spec.ts +++ b/src/tests/runnerOrgs/org_add.spec.ts @@ -56,7 +56,7 @@ describe('adding + getting from all orgs', () => { expect(added_org).toEqual({ "name": "test123", "contact": null, - "address": null, + // "address": null, "teams": [] }) }); @@ -83,7 +83,7 @@ describe('adding + getting explicitly', () => { expect(added_org2).toEqual({ "name": "test123", "contact": null, - "address": null, + // "address": null, "teams": [] }) }); diff --git a/src/tests/runnerOrgs/org_delete.spec.ts b/src/tests/runnerOrgs/org_delete.spec.ts index 08891f8..9598704 100644 --- a/src/tests/runnerOrgs/org_delete.spec.ts +++ b/src/tests/runnerOrgs/org_delete.spec.ts @@ -44,7 +44,7 @@ describe('adding + deletion (successfull)', () => { expect(added_org2).toEqual({ "name": "test123", "contact": null, - "address": null, + // "address": null, "teams": [] }); }); @@ -121,7 +121,7 @@ describe('adding + deletion with teams still existing (with force)', () => { expect(added_org2).toEqual({ "name": "test123", "contact": null, - "address": null + // "address": null }); }); it('check if org really was deleted', async () => { diff --git a/src/tests/runnerOrgs/org_update.spec.ts b/src/tests/runnerOrgs/org_update.spec.ts index e6a1055..a410521 100644 --- a/src/tests/runnerOrgs/org_update.spec.ts +++ b/src/tests/runnerOrgs/org_update.spec.ts @@ -32,7 +32,7 @@ describe('adding + updating name', () => { "id": added_org_id, "name": "testlelele", "contact": null, - "address": null, + // "address": null, }, axios_config); expect(res2.status).toEqual(200); expect(res2.headers['content-type']).toContain("application/json") @@ -42,7 +42,7 @@ describe('adding + updating name', () => { expect(added_org2).toEqual({ "name": "testlelele", "contact": null, - "address": null, + // "address": null, "teams": [] }) }); @@ -65,7 +65,7 @@ describe('adding + try updating id (should return 406)', () => { "id": added_org_id + 1, "name": "testlelele", "contact": null, - "address": null, + // "address": null, }, axios_config); expect(res2.status).toEqual(406); expect(res2.headers['content-type']).toContain("application/json")