Skip to content

Commit ebbedac

Browse files
committed
test(resumeupload): add responsive breakpoint coverage
1 parent e3369ea commit ebbedac

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)