Assessor_2.0/tests/features/policy-analysis-panel.test.tsx

61 lines
3.2 KiB
TypeScript

import { renderToStaticMarkup } from 'react-dom/server';
import { describe, expect, it } from 'vitest';
import { PolicyAnalysisPanelView } from '../../src/features/project-import/PolicyAnalysisPanel';
import type { PolicyAnalysisOverview } from '../../src/domain/policy-analysis-overview';
const overview: PolicyAnalysisOverview = {
version: 1,
projectId: 'synthetic-project',
generatedAt: '2026-08-04T15:00:00.000Z',
summary: {
identityAnalysisRuns: 1, aggregationRuns: 1, evaluationRuns: 1, findingRuns: 1,
configuredMatches: 0, confirmedDeviations: 1, notApplicable: 0, policyFindings: 0,
reviewItems: 2, conflicts: 1, unresolvedIdentities: 0, catalogGaps: 1, parserGaps: 0, partialRuns: 1
},
current: {
version: 1,
summary: {
identityAnalysisRuns: 1, aggregationRuns: 1, evaluationRuns: 1, findingRuns: 1,
configuredMatches: 0, confirmedDeviations: 1, notApplicable: 0, policyFindings: 0,
reviewItems: 2, conflicts: 1, unresolvedIdentities: 0, catalogGaps: 1, parserGaps: 0, partialRuns: 1
},
evaluationRunIds: ['evaluation-1'], findingRunIds: ['finding-run-1'], reviewItems: [{
version: 1, id: 'review-1', category: 'conflict', source: 'snapshot-aggregation', sourceRunId: 'aggregation-1',
identityId: 'technical-identity-1', codes: ['policy-snapshot-customer-conflict'], observationCount: 2, backupCount: 2
}, {
version: 1, id: 'review-2', category: 'catalog-gap', source: 'policy-evaluation', sourceRunId: 'evaluation-1',
codes: ['policy-evaluation-baseline-missing'], observationCount: 1, backupCount: 1
}]
},
actions: { version: 1, reprocess: [], aggregate: [], evaluate: [], createFindings: [] },
profiles: [{ version: 1, id: 'profile-1', name: 'Synthetic Windows', revision: 1, active: true, contextCount: 1 }],
evaluations: [{
version: 1, evaluationRunId: 'evaluation-1', environmentProfileId: 'profile-1', status: 'partial',
completedAt: '2026-08-04T15:00:00.000Z', matchCount: 0, deviationCount: 1,
notApplicableCount: 0, reviewCount: 2, findingCount: 0, rejectedFindingCount: 0
}],
reviewItems: [{
version: 1, id: 'review-1', category: 'conflict', source: 'snapshot-aggregation', sourceRunId: 'aggregation-1',
identityId: 'technical-identity-1', codes: ['policy-snapshot-customer-conflict'], observationCount: 2, backupCount: 2
}, {
version: 1, id: 'review-2', category: 'catalog-gap', source: 'policy-evaluation', sourceRunId: 'evaluation-1',
codes: ['policy-evaluation-baseline-missing'], observationCount: 1, backupCount: 1
}]
};
describe('PolicyAnalysisPanelView', () => {
it('shows the RSoP boundary and presents review hints without severity claims', () => {
const html = renderToStaticMarkup(<PolicyAnalysisPanelView overview={overview}/>);
expect(html).toContain('Effective application is not verified without RSoP or GP Results');
expect(html).toContain('current active snapshot chains');
expect(html).toContain('Evaluation history');
expect(html).toContain('Confirmed policy findings');
expect(html).toContain('Current review queue');
expect(html).toContain('Conflict');
expect(html).toContain('Catalog gap');
expect(html).toContain('policy-evaluation-baseline-missing');
expect(html).not.toContain('Severity');
});
});