Revert "Removed addresses from tests until the circular dependencies are solved"

This reverts commit 599296c4e3.
This commit is contained in:
Nicolai Ort 2021-01-02 19:57:55 +01:00
parent 9c4e54fc6e
commit 56c6a7efb0
4 changed files with 12 additions and 12 deletions

View File

@ -29,7 +29,7 @@ export class RunnerOrganisationController {
@OpenAPI({ description: 'Lists all organisations. <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: [/*'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) {

View File

@ -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": []
})
});

View File

@ -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 () => {

View File

@ -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")