From 53d5d01d0a6df02038d23b84f368ffbd07af3e5a Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Mon, 25 Sep 2023 07:16:10 +0200 Subject: [PATCH] add test --- .../user-import/uc/user-import.uc.spec.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index 3617b5c4e3d..8dcccaf84e2 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -483,6 +483,7 @@ describe('[ImportUserModule]', () => { userMatch1 = userFactory.buildWithId({ school }); userMatch2 = userFactory.buildWithId({ school }); + importUser1 = importUserFactory.buildWithId({ school, user: userMatch1, @@ -505,13 +506,15 @@ describe('[ImportUserModule]', () => { userRepoFlushSpy = userRepo.flush.mockResolvedValueOnce(); permissionServiceSpy = authorizationService.checkAllPermissions.mockReturnValue(); importUserRepoFindImportUsersSpy = importUserRepo.findImportUsers.mockResolvedValue([[], 0]); - accountServiceFindByUserIdSpy = accountService.findByUserIdOrFail.mockResolvedValue({ - id: 'dummyId', - userId: currentUser.id, - username: currentUser.email, - createdAt: new Date(), - updatedAt: new Date(), - }); + accountServiceFindByUserIdSpy = accountService.findByUserId + .mockResolvedValue({ + id: 'dummyId', + userId: currentUser.id, + username: currentUser.email, + createdAt: new Date(), + updatedAt: new Date(), + }) + .mockResolvedValueOnce(null); importUserRepoDeleteImportUsersBySchoolSpy = importUserRepo.deleteImportUsersBySchool.mockResolvedValue(); importUserRepoDeleteImportUserSpy = importUserRepo.delete.mockResolvedValue(); schoolServiceSaveSpy = schoolService.save.mockReturnValueOnce(Promise.resolve(createMockSchoolDo(school)));