Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
annarhughes committed Apr 16, 2024
1 parent aa425e7 commit e72d651
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/user/user.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,9 @@ describe('UserService', () => {
eventLog,
...userBase
} = mockUserEntity;
jest.spyOn(repo, 'createQueryBuilder').mockImplementationOnce(
createQueryBuilderMock({
getMany: jest.fn().mockResolvedValue([{ ...mockUserEntity, email: '[email protected]' }]),
}) as never,
);
jest
.spyOn(repo, 'find')
.mockImplementationOnce(async () => [{ ...mockUserEntity, email: '[email protected]' }]);
const users = await service.getUsers({ email: '[email protected]' }, {}, [], 10);
expect(users).toEqual([{ user: { ...userBase, email: '[email protected]' }, partnerAccesses: [] }]);
});
Expand Down
3 changes: 3 additions & 0 deletions test/utils/mockedServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ export const mockUserRepositoryMethodsFactory = {
...dto,
};
},
find: async () => {
return [mockUserEntity];
},
findOneBy: ({ email: client_email }) => {
return { ...mockUserEntity, ...(client_email ? { email: client_email } : {}) };
},
Expand Down

0 comments on commit e72d651

Please sign in to comment.