pr feedback
This commit is contained in:
parent
ac9e2cd316
commit
0ed5dc869a
3 changed files with 10 additions and 4 deletions
|
@ -38,7 +38,14 @@ export const mapSimpleUser = (entity: UserEntity): UserDto => {
|
|||
email: entity.email,
|
||||
name: entity.name,
|
||||
profileImagePath: entity.profileImagePath,
|
||||
avatarColor: entity.avatarColor ?? getRandomAvatarColor(entity.email.length),
|
||||
avatarColor:
|
||||
entity.avatarColor ??
|
||||
getRandomAvatarColor(
|
||||
entity.email
|
||||
.split('')
|
||||
.map((letter) => letter.charCodeAt(0))
|
||||
.reduce((a, b) => a + b, 0),
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -310,7 +310,6 @@ describe(UserService.name, () => {
|
|||
|
||||
expect(userMock.getAdmin).toBeCalled();
|
||||
expect(userMock.create).toBeCalledWith({
|
||||
avatarColor: expect.anything(),
|
||||
email: userStub.user1.email,
|
||||
name: userStub.user1.name,
|
||||
storageLabel: 'label',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserDtoAvatarColorEnum, type UserResponseDto } from '@api';
|
||||
import { UserAvatarColor, type UserResponseDto } from '@api';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { Sync } from 'factory.ts';
|
||||
|
||||
|
@ -16,5 +16,5 @@ export const userFactory = Sync.makeFactory<UserResponseDto>({
|
|||
updatedAt: Sync.each(() => faker.date.past().toISOString()),
|
||||
memoriesEnabled: true,
|
||||
oauthId: '',
|
||||
avatarColor: UserDtoAvatarColorEnum.Primary,
|
||||
avatarColor: UserAvatarColor.Primary,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue