refactor: adapt for typeorm 0.3

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-03-20 22:40:41 +01:00
parent a07b5f54d1
commit c4975e4783
21 changed files with 131 additions and 69 deletions

View file

@ -115,7 +115,7 @@ describe('UsersService', () => {
expect(getUser.displayName).toEqual(displayname);
});
it('fails when user does not exits', async () => {
jest.spyOn(userRepo, 'findOne').mockResolvedValueOnce(undefined);
jest.spyOn(userRepo, 'findOne').mockResolvedValueOnce(null);
await expect(service.getUserByUsername(username)).rejects.toThrow(
NotInDBError,
);

View file

@ -89,7 +89,7 @@ export class UsersService {
where: { username: username },
relations: withRelations,
});
if (user === undefined) {
if (user === null) {
throw new NotInDBError(`User with username '${username}' not found`);
}
return user;