diff --git a/apps/web-app/src/pages/Home.tsx b/apps/web-app/src/pages/Home.tsx index 19b71f4e..b326ccdc 100644 --- a/apps/web-app/src/pages/Home.tsx +++ b/apps/web-app/src/pages/Home.tsx @@ -255,7 +255,7 @@ export function Home(): React.ReactElement { ) : ( { diff --git a/apps/web-app/src/pages/__tests__/Home.test.tsx b/apps/web-app/src/pages/__tests__/Home.test.tsx index b8ed1b54..92977a02 100644 --- a/apps/web-app/src/pages/__tests__/Home.test.tsx +++ b/apps/web-app/src/pages/__tests__/Home.test.tsx @@ -20,17 +20,19 @@ vi.mock('../../context/SkillContext', async (importOriginal) => { return { ...actual, useSkills: vi.fn() }; }); +const virtuosoGridMock = vi.fn(({ totalCount, itemContent }: any) => ( +
+ {Array.from({ length: totalCount || 0 }).map((_, index) => ( +
+ {itemContent(index)} +
+ ))} +
+)); + // Mock VirtuosoGrid to render items normally for easier testing vi.mock('react-virtuoso', () => ({ - VirtuosoGrid: ({ totalCount, itemContent }: any) => ( -
- {Array.from({ length: totalCount || 0 }).map((_, index) => ( -
- {itemContent(index)} -
- ))} -
- ), + VirtuosoGrid: (props: any) => virtuosoGridMock(props), })); describe('Home', () => { @@ -71,6 +73,10 @@ describe('Home', () => { expect(screen.getByText('@Skill 1')).toBeInTheDocument(); expect(screen.getByText('@Skill 2')).toBeInTheDocument(); }); + + expect(virtuosoGridMock).toHaveBeenCalledWith( + expect.objectContaining({ useWindowScroll: true }), + ); }); it('should set homepage SEO metadata', async () => {