Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Nov 28, 2023
1 parent 1b7a3e6 commit 6ee763a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger';
import { SanisSonstigeGruppenzugehoerigeResponse } from '../strategy';
import { SanisSonstigeGruppenzugehoerigeResponse } from '../strategy/sanis/response';

export class GroupRoleUnknownLoggable implements Loggable {
constructor(private readonly relation: SanisSonstigeGruppenzugehoerigeResponse) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Type } from 'class-transformer';
import { ValidateNested } from 'class-validator';
import { IsOptional, ValidateNested } from 'class-validator';
import { SanisGruppeResponse } from './sanis-gruppe-response';
import { SanisGruppenzugehoerigkeitResponse } from './sanis-gruppenzugehoerigkeit-response';
import { SanisSonstigeGruppenzugehoerigeResponse } from './sanis-sonstige-gruppenzugehoerige-response';
Expand All @@ -13,7 +13,8 @@ export class SanisGruppenResponse {
@Type(() => SanisGruppenzugehoerigkeitResponse)
gruppenzugehoerigkeit!: SanisGruppenzugehoerigkeitResponse;

@IsOptional()
@ValidateNested()
@Type(() => SanisGruppenzugehoerigkeitResponse)
sonstige_gruppenzugehoerige!: SanisSonstigeGruppenzugehoerigeResponse[];
sonstige_gruppenzugehoerige?: SanisSonstigeGruppenzugehoerigeResponse[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,31 +145,12 @@ describe('SanisResponseMapper', () => {
});
});

describe('when group data set does not have the group info', () => {
const setup = () => {
const { sanisResponse } = setupSanisResponse();
sanisResponse.personenkontexte[0].gruppen[0].gruppe = undefined;

return {
sanisResponse,
};
};

it('should not map the group', () => {
const { sanisResponse } = setup();

const result: ExternalGroupDto[] | undefined = mapper.mapToExternalGroupDtos(sanisResponse);

expect(result).toHaveLength(0);
});
});

describe('when group type is given', () => {
const setup = () => {
const { sanisResponse } = setupSanisResponse();
const personenkontext: SanisPersonenkontextResponse = sanisResponse.personenkontexte[0];
const group: SanisGruppenResponse = personenkontext.gruppen![0];
const otherParticipant: SanisSonstigeGruppenzugehoerigeResponse = group.sonstige_gruppenzugehoerige[0];
const otherParticipant: SanisSonstigeGruppenzugehoerigeResponse = group.sonstige_gruppenzugehoerige![0];

return {
sanisResponse,
Expand Down Expand Up @@ -262,7 +243,7 @@ describe('SanisResponseMapper', () => {
describe('when no other participants are provided', () => {
const setup = () => {
const { sanisResponse } = setupSanisResponse();
sanisResponse.personenkontexte[0].gruppen![0]!.sonstige_gruppenzugehoerige = undefined;
sanisResponse.personenkontexte[0].gruppen![0].sonstige_gruppenzugehoerige = undefined;

return {
sanisResponse,
Expand Down

0 comments on commit 6ee763a

Please sign in to comment.