Skip to content

Commit 20f589c

Browse files
authored
fix(test): mock WallOfLove and DiscordButton in page tests (JhaSourav07#2233)
## Description Fixes JhaSourav07#2231 Resolves JSDOM timeouts in `app/page.test.tsx` by mocking/stubbing `WallOfLove` and `DiscordButton` within the LandingPage tests. This isolates the component under test from infinite GSAP loop cycles and ScrollTrigger event listeners that freeze JSDOM. ## Pillar - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=...`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors. - [x] I have run `npm run test` and all tests pass locally. - [x] I have run `npm run test:coverage` and branch coverage is at or above 70%. - [x] My commits follow the Conventional Commits format. - [x] I have made sure that I have only one commit to merge in this PR.
2 parents d548cbf + 821bda9 commit 20f589c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

app/page.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ vi.mock('@/components/commitpulse-logo', () => ({
1414
CommitPulseLogo: () => <svg data-testid="commitpulse-logo"></svg>,
1515
}));
1616

17+
vi.mock('@/components/WallOfLove', () => ({
18+
WallOfLove: () => <div data-testid="wall-of-love">Wall of Love</div>,
19+
}));
20+
21+
vi.mock('@/components/DiscordButton', () => ({
22+
DiscordButton: () => <button data-testid="discord-button">Discord Button</button>,
23+
}));
24+
1725
// next/image is no longer used — SVG preview is fetched via useEffect and
1826
// rendered inline. The mock below keeps the import from erroring if any
1927
// other test file still imports it.

0 commit comments

Comments
 (0)