Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions app/components/Icons.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';
import { describe, it, expect } from 'vitest';
import { CopyIcon, ZapIcon, BoxIcon, CheckIcon, CloseIcon } from './Icons';

describe('Icons', () => {
it('renders all 5 icons as valid SVG elements without crashing', () => {
const icons = [CopyIcon, ZapIcon, BoxIcon, CheckIcon, CloseIcon];

icons.forEach((Icon) => {
const { container } = render(<Icon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
});
});

it('renders CopyIcon with correct attributes', () => {
const { container } = render(<CopyIcon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg).toHaveAttribute('width', '20');
expect(svg).toHaveAttribute('height', '20');
expect(svg).toHaveAttribute('stroke-width', '2');
});

it('renders ZapIcon with correct attributes', () => {
const { container } = render(<ZapIcon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg).toHaveAttribute('width', '24');
expect(svg).toHaveAttribute('height', '24');
expect(svg).toHaveAttribute('stroke-width', '2');
});

it('renders BoxIcon with correct attributes', () => {
const { container } = render(<BoxIcon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg).toHaveAttribute('width', '24');
expect(svg).toHaveAttribute('height', '24');
expect(svg).toHaveAttribute('stroke-width', '2');
});

it('renders CheckIcon with correct attributes including green stroke color', () => {
const { container } = render(<CheckIcon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg).toHaveAttribute('width', '20');
expect(svg).toHaveAttribute('height', '20');
expect(svg).toHaveAttribute('stroke-width', '3');
expect(svg).toHaveAttribute('stroke', '#10b981');
});

it('renders CloseIcon with correct attributes', () => {
const { container } = render(<CloseIcon />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg).toHaveAttribute('width', '18');
expect(svg).toHaveAttribute('height', '18');
expect(svg).toHaveAttribute('stroke-width', '2.5');
});
});
Loading