Fix #21468 : Profile picture display issue (#21474)

* fix profile url issue

* added unit test
This commit is contained in:
Shrushti Polekar 2025-05-30 10:46:35 +05:30 committed by GitHub
parent 980e722e24
commit 324aab71a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View File

@ -243,7 +243,7 @@ const ProfileSectionUserDetailsCard = ({
<div className="d-flex items-center">
<ProfilePicture
data-testid="replied-user"
name={getEntityName(userData)}
name={userData?.name}
width="80"
/>
</div>

View File

@ -28,8 +28,9 @@ jest.mock('../../../utils/UserDataUtils', () => {
};
});
const mockUseUserProfile = jest.fn().mockReturnValue(['', false, {}]);
jest.mock('../../../hooks/user-profile/useUserProfile', () => ({
useUserProfile: jest.fn().mockImplementation(() => ['', false, {}]),
useUserProfile: () => mockUseUserProfile(),
}));
const mockData = {
@ -44,4 +45,18 @@ describe('Test ProfilePicture component', () => {
expect(avatar).toBeInTheDocument();
});
it('should render with profile image when profileURL is available', async () => {
mockUseUserProfile.mockReturnValue([
'https://example.com/profile.jpg',
false,
{},
]);
const { container } = render(<ProfilePicture {...mockData} width="36" />);
const profileImage = await findByTestId(container, 'profile-image');
expect(profileImage).toBeInTheDocument();
});
});