Removed addresses from tests until the circular dependencies are solved
ref #65
This commit is contained in:
parent
2594a607dc
commit
599296c4e3
@ -29,7 +29,7 @@ export class RunnerOrganisationController {
|
|||||||
@OpenAPI({ description: 'Lists all organisations. <br> This includes their address, contact and teams (if existing/associated).' })
|
@OpenAPI({ description: 'Lists all organisations. <br> This includes their address, contact and teams (if existing/associated).' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
|
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 => {
|
runners.forEach(runner => {
|
||||||
responseTeams.push(new ResponseRunnerOrganisation(runner));
|
responseTeams.push(new ResponseRunnerOrganisation(runner));
|
||||||
});
|
});
|
||||||
@ -43,7 +43,7 @@ export class RunnerOrganisationController {
|
|||||||
@OnUndefined(RunnerOrganisationNotFoundError)
|
@OnUndefined(RunnerOrganisationNotFoundError)
|
||||||
@OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' })
|
@OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' })
|
||||||
async getOne(@Param('id') id: number) {
|
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(); }
|
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
|
||||||
return new ResponseRunnerOrganisation(runnerOrg);
|
return new ResponseRunnerOrganisation(runnerOrg);
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ export class RunnerOrganisationController {
|
|||||||
|
|
||||||
runnerOrganisation = await this.runnerOrganisationRepository.save(runnerOrganisation);
|
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')
|
@Put('/:id')
|
||||||
@ -84,7 +84,7 @@ export class RunnerOrganisationController {
|
|||||||
|
|
||||||
await this.runnerOrganisationRepository.save(await updateOrganisation.updateRunnerOrganisation(oldRunnerOrganisation));
|
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')
|
@Delete('/:id')
|
||||||
@ -98,7 +98,7 @@ export class RunnerOrganisationController {
|
|||||||
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
||||||
let organisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
let organisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
||||||
if (!organisation) { return null; }
|
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 (!force) {
|
||||||
if (runnerOrganisation.teams.length != 0) {
|
if (runnerOrganisation.teams.length != 0) {
|
||||||
|
@ -56,7 +56,7 @@ describe('adding + getting from all orgs', () => {
|
|||||||
expect(added_org).toEqual({
|
expect(added_org).toEqual({
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
"teams": []
|
"teams": []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -83,7 +83,7 @@ describe('adding + getting explicitly', () => {
|
|||||||
expect(added_org2).toEqual({
|
expect(added_org2).toEqual({
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
"teams": []
|
"teams": []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ describe('adding + deletion (successfull)', () => {
|
|||||||
expect(added_org2).toEqual({
|
expect(added_org2).toEqual({
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
"teams": []
|
"teams": []
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -121,7 +121,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
|
|||||||
expect(added_org2).toEqual({
|
expect(added_org2).toEqual({
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null
|
// "address": null
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('check if org really was deleted', async () => {
|
it('check if org really was deleted', async () => {
|
||||||
|
@ -32,7 +32,7 @@ describe('adding + updating name', () => {
|
|||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res2.status).toEqual(200);
|
expect(res2.status).toEqual(200);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
@ -42,7 +42,7 @@ describe('adding + updating name', () => {
|
|||||||
expect(added_org2).toEqual({
|
expect(added_org2).toEqual({
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
"teams": []
|
"teams": []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -65,7 +65,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||||||
"id": added_org_id + 1,
|
"id": added_org_id + 1,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
"address": null,
|
// "address": null,
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res2.status).toEqual(406);
|
expect(res2.status).toEqual(406);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user