Skip to content

Commit 8a2c082

Browse files
committed
test(icons): add empty fallback coverage
1 parent c091e3e commit 8a2c082

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { render } from '@testing-library/react';
2+
import { describe, expect, it, vi } from 'vitest';
3+
4+
import { BoxIcon, CheckIcon, CloseIcon, CopyIcon, ZapIcon } from './Icons';
5+
6+
type IconProps = React.SVGProps<SVGSVGElement>;
7+
8+
vi.mock('lucide-react', () => ({
9+
Copy: (props: IconProps) => <svg data-testid="copy-icon" {...props} />,
10+
Zap: (props: IconProps) => <svg data-testid="zap-icon" {...props} />,
11+
Box: (props: IconProps) => <svg data-testid="box-icon" {...props} />,
12+
Check: (props: IconProps) => <svg data-testid="check-icon" {...props} />,
13+
X: (props: IconProps) => <svg data-testid="close-icon" {...props} />,
14+
}));
15+
16+
describe('Icons empty fallback behavior', () => {
17+
it('renders CopyIcon without crashing', () => {
18+
const { getByTestId } = render(<CopyIcon />);
19+
expect(getByTestId('copy-icon')).toBeDefined();
20+
});
21+
22+
it('renders ZapIcon without crashing', () => {
23+
const { getByTestId } = render(<ZapIcon />);
24+
expect(getByTestId('zap-icon')).toBeDefined();
25+
});
26+
27+
it('renders BoxIcon without crashing', () => {
28+
const { getByTestId } = render(<BoxIcon />);
29+
expect(getByTestId('box-icon')).toBeDefined();
30+
});
31+
32+
it('renders CheckIcon with fallback styling', () => {
33+
const { getByTestId } = render(<CheckIcon />);
34+
const icon = getByTestId('check-icon');
35+
36+
expect(icon.getAttribute('stroke')).toBe('#10b981');
37+
});
38+
39+
it('renders CloseIcon without runtime errors', () => {
40+
const { getByTestId } = render(<CloseIcon />);
41+
expect(getByTestId('close-icon')).toBeDefined();
42+
});
43+
});

0 commit comments

Comments
 (0)