Skip to content

Commit

Permalink
adjust i18 for Person-UEM-Password, adjust test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DPDS93CT committed Dec 11, 2024
1 parent e864b06 commit 26c1d76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/person/api/dbiam-person.error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export enum PersonErrorI18nTypes {
PERSONALNUMMER_REQUIRED = 'PERSONALNUMMER_REQUIRED',
NEWER_VERSION_OF_PERSON_AVAILABLE = 'NEWER_VERSION_OF_PERSON_AVAILABLE',
PERSONALNUMMER_NICHT_EINDEUTIG = 'PERSONALNUMMER_NICHT_EINDEUTIG',
PERSON_PASSWORD_MODIFICATION_ERROR = 'PERSON_PASSWORD_MODIFICATION_ERROR',
PERSON_UEM_PASSWORD_MODIFICATION_ERROR = 'PERSON_UEM_PASSWORD_MODIFICATION_ERROR',
}

export type DbiamPersonErrorProps = DbiamErrorProps & {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/person/api/person-exception-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class PersonExceptionFilter implements ExceptionFilter<PersonDomainError>
PersonUserPasswordModificationError.name,
new DbiamPersonError({
code: 500,
i18nKey: PersonErrorI18nTypes.PERSON_PASSWORD_MODIFICATION_ERROR,
i18nKey: PersonErrorI18nTypes.PERSON_UEM_PASSWORD_MODIFICATION_ERROR,
}),
],
]);
Expand Down
9 changes: 9 additions & 0 deletions src/modules/person/api/person.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ describe('PersonController', () => {
true,
);
personRepositoryMock.updatePersonMetadata.mockResolvedValue(new MismatchedRevisionError(''));

await expect(
personController.updateMetadata(params, bodyWithInvalidRevision, personPermissionsMock),
).rejects.toThrow(HttpException);
Expand Down Expand Up @@ -1042,6 +1043,10 @@ describe('PersonController', () => {
personController.resetUEMPasswordByPersonId(params, personPermissionsMock),
).resolves.not.toThrow();
expect(ldapClientServiceMock.changeUserPasswordByPersonId).toHaveBeenCalledTimes(1);
expect(ldapClientServiceMock.changeUserPasswordByPersonId).toHaveBeenCalledWith(
person.id,
person.referrer,
);
});
});

Expand All @@ -1067,6 +1072,10 @@ describe('PersonController', () => {
personController.resetUEMPasswordByPersonId(params, personPermissionsMock),
).rejects.toThrow(PersonUserPasswordModificationError);
expect(ldapClientServiceMock.changeUserPasswordByPersonId).toHaveBeenCalledTimes(1);
expect(ldapClientServiceMock.changeUserPasswordByPersonId).toHaveBeenCalledWith(
person.id,
person.referrer,
);
});
});
});
Expand Down

0 comments on commit 26c1d76

Please sign in to comment.