@@ -176,7 +167,7 @@ const GithubStarCard = () => {
starredCount
)}
-
+
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/GithubStarCard/GithubStarCard.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/GithubStarCard/GithubStarCard.test.tsx
index 42d620f1b49..38b8e048e75 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/GithubStarCard/GithubStarCard.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/GithubStarCard/GithubStarCard.test.tsx
@@ -16,20 +16,10 @@ import { TWO_MINUTE_IN_MILLISECOND } from '../../../constants/constants';
import useCustomLocation from '../../../hooks/useCustomLocation/useCustomLocation';
import GithubStarCard from './GithubStarCard.component';
-const mockLinkButton = jest.fn();
-
jest.mock('../../../hooks/useCustomLocation/useCustomLocation', () => {
return jest.fn().mockImplementation(() => ({ pathname: '/my-data' }));
});
-jest.mock('react-router-dom', () => ({
- Link: jest.fn().mockImplementation(({ children, ...rest }) => (
-
- {children}
-
- )),
-}));
-
jest.mock('../../../utils/WhatsNewModal.util', () => ({
getReleaseVersionExpiry: jest.fn().mockImplementation(() => new Date()),
}));
@@ -72,21 +62,26 @@ describe('GithubStarCard', () => {
expect(screen.getByRole('button', { name: '10' })).toBeInTheDocument();
});
- it('check redirect buttons', async () => {
+ it('check redirect buttons have correct links', async () => {
render(
);
jest.advanceTimersByTime(TWO_MINUTE_IN_MILLISECOND);
- const starTextButton = await screen.findByRole('button', {
- name: 'label.star',
- });
+ await screen.findByTestId('github-star-popup-card');
- fireEvent.click(starTextButton);
+ // Check that both links point to the correct GitHub repository
+ const links = screen.getAllByRole('link');
- const countButton = screen.getByRole('button', { name: '10' });
-
- fireEvent.click(countButton);
-
- expect(mockLinkButton).toHaveBeenCalledTimes(2);
+ expect(links).toHaveLength(2);
+ expect(links[0]).toHaveAttribute(
+ 'href',
+ 'https://star-us.open-metadata.org/'
+ );
+ expect(links[0]).toHaveAttribute('target', '_blank');
+ expect(links[1]).toHaveAttribute(
+ 'href',
+ 'https://star-us.open-metadata.org/'
+ );
+ expect(links[1]).toHaveAttribute('target', '_blank');
});
it('should close the alert when the close button is clicked', async () => {