Skip to content

Commit 7f2e7f7

Browse files
authored
test: add ComparePage mock integration coverage (JhaSourav07#3319)
git push origin test-compare-mock-integrations ## Description Fixes JhaSourav07#2801 ## Pillar - [x] 🎨 Pillar 1 β€” New Theme Design - [x] πŸ“ Pillar 2 β€” Geometric SVG Improvement - [x] πŸ• Pillar 3 β€” Timezone Logic Optimization - [x] πŸ› οΈ Other (Bug fix, refactoring, docs) ## Visual Preview ## 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=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 7d74612 + 5dc77e8 commit 7f2e7f7

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { render, screen } from '@testing-library/react';
2+
import '@testing-library/jest-dom/vitest';
3+
import { describe, expect, it, vi } from 'vitest';
4+
5+
vi.mock('./CompareClient', () => ({
6+
default: () => <div>Mock Compare Client</div>,
7+
}));
8+
9+
vi.mock('../components/Footer', () => ({
10+
Footer: () => <div>Mock Footer</div>,
11+
}));
12+
13+
import ComparePage from './page';
14+
15+
describe('ComparePage mock integrations', () => {
16+
it('renders CompareClient through mocked service layer', () => {
17+
render(<ComparePage />);
18+
19+
expect(screen.getByText('Mock Compare Client')).toBeInTheDocument();
20+
});
21+
22+
it('renders Footer component', () => {
23+
render(<ComparePage />);
24+
25+
expect(screen.getByText('Mock Footer')).toBeInTheDocument();
26+
});
27+
28+
it('renders CompareClient only once', () => {
29+
render(<ComparePage />);
30+
31+
expect(screen.getAllByText('Mock Compare Client')).toHaveLength(1);
32+
});
33+
34+
it('renders Footer only once', () => {
35+
render(<ComparePage />);
36+
37+
expect(screen.getAllByText('Mock Footer')).toHaveLength(1);
38+
});
39+
40+
it('renders page layout with both mocked integrations', () => {
41+
render(<ComparePage />);
42+
43+
expect(screen.getByText('Mock Compare Client')).toBeInTheDocument();
44+
expect(screen.getByText('Mock Footer')).toBeInTheDocument();
45+
});
46+
});

0 commit comments

Comments
Β (0)