Full tests coverage

This commit is contained in:
Aerilyn Weber 2026-05-19 14:09:03 +09:00
parent 99134d8556
commit 02d782c3da
157 changed files with 1074 additions and 34670 deletions

View file

@ -6,6 +6,7 @@ import { Ring } from '../../src/components/ui/Ring';
import { SparkBars } from '../../src/components/ui/SparkBars';
import { SupplyBar } from '../../src/components/ui/SupplyBar';
import { Card, CardHeader, CardBody } from '../../src/components/ui/Card';
import { Icon } from '../../src/components/ui/Icon';
describe('Avatar', () => {
it('renders initial from name', () => {
@ -19,6 +20,11 @@ describe('Avatar', () => {
const el = screen.getByLabelText('Bob');
expect(el).toHaveStyle({ width: '48px', height: '48px' });
});
it('falls back to ? for empty name', () => {
render(<Avatar name="" />);
expect(screen.getByText('?')).toBeInTheDocument();
});
});
describe('IconButton', () => {
@ -116,3 +122,17 @@ describe('Card', () => {
expect(screen.getByText('Body Content')).toBeInTheDocument();
});
});
describe('Icon', () => {
it('renders paths for valid icon', () => {
const { container } = render(<Icon name="bell" />);
expect(container.querySelector('svg')).toBeInTheDocument();
});
it('renders null for invalid icon name', () => {
const { container } = render(<Icon name="nonexistent" as any />);
const svg = container.querySelector('svg');
expect(svg).toBeInTheDocument();
expect(svg?.childNodes.length).toBe(0);
});
});