From 1df6ffad723bf90f27f61fea0b9d688a422815da Mon Sep 17 00:00:00 2001 From: Yannick Clausen Date: Mon, 9 Sep 2024 15:41:04 +0200 Subject: [PATCH] refactor test --- src/modules/authentication/api/userinfo.response.spec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/authentication/api/userinfo.response.spec.ts b/src/modules/authentication/api/userinfo.response.spec.ts index c85749636..b7c55257c 100644 --- a/src/modules/authentication/api/userinfo.response.spec.ts +++ b/src/modules/authentication/api/userinfo.response.spec.ts @@ -7,12 +7,13 @@ import { DBiamPersonenkontextRepo } from '../../personenkontext/persistence/dbia import { OrganisationRepository } from '../../organisation/persistence/organisation.repository.js'; import { RolleRepo } from '../../rolle/repo/rolle.repo.js'; import { PersonenkontextRolleFieldsResponse } from './personen-kontext-rolle-fields.response.js'; +import { createMock } from '@golevelup/ts-jest'; describe('UserinfoResponse', () => { const permissions: PersonPermissions = new PersonPermissions( - jest.fn() as unknown as DBiamPersonenkontextRepo, - jest.fn() as unknown as OrganisationRepository, - jest.fn() as unknown as RolleRepo, + createMock(), + createMock(), + createMock(), DoFactory.createPerson(true), ); const pk: PersonenkontextRolleFieldsResponse = { @@ -26,7 +27,7 @@ describe('UserinfoResponse', () => { expect(userinfoResponse.password_updated_at).toBeUndefined(); }); - it('constructs the object without optional extension', () => { + it('constructs the object with optional extension', () => { const extension: UserinfoExtension = { password_updated_at: faker.date.past().valueOf() }; const userinfoResponse: UserinfoResponse = new UserinfoResponse(permissions, [pk], extension); expect(userinfoResponse).toBeDefined();