mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-17 21:46:50 +00:00
* fix profile url issue * added unit test
This commit is contained in:
parent
980e722e24
commit
324aab71a4
@ -243,7 +243,7 @@ const ProfileSectionUserDetailsCard = ({
|
|||||||
<div className="d-flex items-center">
|
<div className="d-flex items-center">
|
||||||
<ProfilePicture
|
<ProfilePicture
|
||||||
data-testid="replied-user"
|
data-testid="replied-user"
|
||||||
name={getEntityName(userData)}
|
name={userData?.name}
|
||||||
width="80"
|
width="80"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,8 +28,9 @@ jest.mock('../../../utils/UserDataUtils', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mockUseUserProfile = jest.fn().mockReturnValue(['', false, {}]);
|
||||||
jest.mock('../../../hooks/user-profile/useUserProfile', () => ({
|
jest.mock('../../../hooks/user-profile/useUserProfile', () => ({
|
||||||
useUserProfile: jest.fn().mockImplementation(() => ['', false, {}]),
|
useUserProfile: () => mockUseUserProfile(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockData = {
|
const mockData = {
|
||||||
@ -44,4 +45,18 @@ describe('Test ProfilePicture component', () => {
|
|||||||
|
|
||||||
expect(avatar).toBeInTheDocument();
|
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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user