import { describe, it, expect } from 'vitest' import { render } from '@testing-library/react' import { KnowledgeUnitCard } from './KnowledgeUnitCard' import type { KnowledgeUnit } from '@/lib/sdk/advisor/evidence' const base: KnowledgeUnit = { id: 's1', regulation: { code: 'dsk', short: 'DSK Sdm B51' } } describe('KnowledgeUnitCard', () => { it('does not duplicate the regulation when label equals the short name', () => { const { container } = render() const occurrences = (container.textContent?.match(/DSK Sdm B51/g) || []).length expect(occurrences).toBe(1) }) it('shows the label when it differs from the short name (no breadcrumb)', () => { const { container } = render() expect(container.textContent).toContain('DSK Sdm B51') expect(container.textContent).toContain('Art. 30 DSGVO') }) it('renders the section/paragraph breadcrumb when present', () => { const { container } = render( , ) expect(container.textContent).toContain('Art. 5') expect(container.textContent).toContain('Abs. 2') }) })