import { render, screen } from '@testing-library/react'; import { describe, it, expect } from 'vitest'; import { ComplianceBadgeRow } from './ComplianceBadgeRow'; import React from 'react'; const badges = [ { icon: , label: 'SOC 2 Type II', description: 'Audited annually' }, { icon: , label: 'GDPR' }, { icon: , label: 'WCAG 2.1 AA', description: 'Accessibility compliant' }, ]; describe('ComplianceBadgeRow', () => { it('renders a label for each badge', () => { render(); expect(screen.getByText('SOC 2 Type II')).toBeInTheDocument(); expect(screen.getByText('GDPR')).toBeInTheDocument(); expect(screen.getByText('WCAG 2.1 AA')).toBeInTheDocument(); }); it('renders each badge icon', () => { render(); expect(screen.getByTestId('icon-soc2')).toBeInTheDocument(); expect(screen.getByTestId('icon-gdpr')).toBeInTheDocument(); expect(screen.getByTestId('icon-wcag')).toBeInTheDocument(); }); it('renders the description only for badges that provide one', () => { render(); expect(screen.getByText('Audited annually')).toBeInTheDocument(); expect(screen.getByText('Accessibility compliant')).toBeInTheDocument(); // GDPR badge has no description text of its own. expect(screen.queryByText('GDPR')?.parentElement?.textContent).toBe('GDPR'); }); it('renders an empty grid when given no badges', () => { const { container } = render(); expect(container.querySelector('div')?.children).toHaveLength(0); }); it('applies a custom className to the wrapper', () => { const { container } = render(); expect(container.firstChild).toHaveClass('custom-badges'); }); });