feat(advisor): Case Workspace v2 — Evidence grouping, human names, 3-column, summary
Reworks the advisor toward a Compliance Case Workspace (review feedback): - Rename user-facing "Quellen" -> "Evidence". - Evidence grouped by document/regulation family (count + expandable) — no more unsorted DSK/DSK/DPF/... jumble. - Human-readable regulation names via a display registry (DSK Sdm B51 -> "DSK Standard-Datenschutzmodell (SDM)" / Kapitel B51); generic, bridges G2. - Evidence summary "Antwort basiert auf" with meaningful counts; Regelwerke = distinct FAMILIES (fixes the inflated count). NO fabricated trust score (needs a defined basis). - Expanded mode = 3-column workspace (question+summary | answer | evidence, independent scroll) + history switcher; narrow mode stays stacked. - Prompt: push aggressive markdown structure (## per aspect, numbered phases). Deferred/coordinated on board: C8 diagrams (RAG contract), answer<->evidence coupling [1] (needs LLM citation anchors — phase 2), G1 retrieval relevance + G2 metadata (RAG). tsc clean, 17 vitest, check-loc 0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3,26 +3,29 @@ 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(<KnowledgeUnitCard unit={{ ...base, label: 'DSK Sdm B51' }} />)
|
||||
const occurrences = (container.textContent?.match(/DSK Sdm B51/g) || []).length
|
||||
expect(occurrences).toBe(1)
|
||||
it('shows the friendly regulation name (not the raw code) when standalone', () => {
|
||||
const unit: KnowledgeUnit = { id: 's1', regulation: { code: 'cra', short: 'CRA' } }
|
||||
const { container } = render(<KnowledgeUnitCard unit={unit} />)
|
||||
expect(container.textContent).toContain('Cyber Resilience Act (CRA)')
|
||||
})
|
||||
|
||||
it('shows the label when it differs from the short name (no breadcrumb)', () => {
|
||||
const { container } = render(<KnowledgeUnitCard unit={{ ...base, label: 'Art. 30 DSGVO' }} />)
|
||||
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(
|
||||
<KnowledgeUnitCard unit={{ ...base, section: 'Art. 5', paragraph: 'Abs. 2' }} />,
|
||||
)
|
||||
it('renders the section/paragraph breadcrumb', () => {
|
||||
const unit: KnowledgeUnit = {
|
||||
id: 's2',
|
||||
regulation: { code: 'dsgvo', short: 'DSGVO' },
|
||||
section: 'Art. 5',
|
||||
paragraph: 'Abs. 2',
|
||||
}
|
||||
const { container } = render(<KnowledgeUnitCard unit={unit} />)
|
||||
expect(container.textContent).toContain('Art. 5')
|
||||
expect(container.textContent).toContain('Abs. 2')
|
||||
})
|
||||
|
||||
it('compact mode shows the chapter and omits the family name (group provides it)', () => {
|
||||
const unit: KnowledgeUnit = { id: 's3', regulation: { code: 'dsk_sdm_b51', short: 'DSK Sdm B51' } }
|
||||
const { container } = render(<KnowledgeUnitCard unit={unit} compact />)
|
||||
expect(container.textContent).toContain('Kapitel B51')
|
||||
expect(container.textContent).not.toContain('Standard-Datenschutzmodell')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user