Skip to content

Commit 1355277

Browse files
authored
test(resumeupload): add responsive breakpoint coverage (JhaSourav07#3227)
## Description Fixes JhaSourav07#2719 This PR adds the new test file: `components/dashboard/ResumeUpload.responsive-breakpoints.test.tsx` The new test suite validates responsive rendering behavior for `ResumeUpload.tsx` across mobile, tablet, and desktop viewport sizes. It also verifies that upload controls remain accessible and stable on smaller screens without responsive layout failures. ## Pillar * [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (test coverage update) ## 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): ...`). * [ ] 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 29dd950 + ebbedac commit 1355277

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { render, screen } from '@testing-library/react';
2+
import { describe, it, expect, vi, beforeEach } from 'vitest';
3+
import ResumeUpload from './ResumeUpload';
4+
import type { ReactNode, HTMLAttributes } from 'react';
5+
import '@testing-library/jest-dom';
6+
7+
vi.mock('framer-motion', () => ({
8+
motion: {
9+
div: ({ children, ...props }: HTMLAttributes<HTMLDivElement> & { children?: ReactNode }) => (
10+
<div {...props}>{children}</div>
11+
),
12+
},
13+
AnimatePresence: ({ children }: { children: ReactNode }) => <>{children}</>,
14+
}));
15+
16+
describe('ResumeUpload responsive breakpoints', () => {
17+
const onParsed = vi.fn();
18+
const onError = vi.fn();
19+
20+
beforeEach(() => {
21+
vi.clearAllMocks();
22+
23+
Object.defineProperty(window, 'innerWidth', {
24+
writable: true,
25+
configurable: true,
26+
value: 375,
27+
});
28+
});
29+
30+
it('renders correctly on mobile viewport', () => {
31+
render(<ResumeUpload onParsed={onParsed} onError={onError} />);
32+
33+
expect(screen.getByLabelText('Upload resume')).toBeInTheDocument();
34+
});
35+
36+
it('supports narrow mobile widths without crashing', () => {
37+
window.innerWidth = 320;
38+
39+
render(<ResumeUpload onParsed={onParsed} onError={onError} />);
40+
41+
expect(screen.getByLabelText('Upload resume')).toBeVisible();
42+
});
43+
44+
it('renders upload interface on tablet viewport', () => {
45+
window.innerWidth = 768;
46+
47+
render(<ResumeUpload onParsed={onParsed} onError={onError} />);
48+
49+
expect(screen.getByLabelText('Upload resume')).toBeInTheDocument();
50+
});
51+
52+
it('renders upload interface on desktop viewport', () => {
53+
window.innerWidth = 1280;
54+
55+
render(<ResumeUpload onParsed={onParsed} onError={onError} />);
56+
57+
expect(screen.getByLabelText('Upload resume')).toBeInTheDocument();
58+
});
59+
60+
it('maintains accessible upload controls across breakpoints', () => {
61+
render(<ResumeUpload onParsed={onParsed} onError={onError} />);
62+
63+
const input = screen.getByLabelText('Upload resume');
64+
65+
expect(input).toHaveAttribute('type', 'file');
66+
});
67+
});

0 commit comments

Comments
 (0)