50 lines
2.4 KiB
TypeScript
50 lines
2.4 KiB
TypeScript
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { PolicyAnalysisActions } from '../../src/features/project-import/PolicyAnalysisActions';
|
|
import type { PolicyAnalysisOverview } from '../../src/domain/policy-analysis-overview';
|
|
|
|
const overview = {
|
|
version: 1,
|
|
projectId: 'project-1', generatedAt: '2026-08-04T16:00:00.000Z',
|
|
summary: {
|
|
identityAnalysisRuns: 1, aggregationRuns: 1, evaluationRuns: 1, findingRuns: 0,
|
|
configuredMatches: 0, confirmedDeviations: 0, notApplicable: 0, policyFindings: 0,
|
|
reviewItems: 1, conflicts: 0, unresolvedIdentities: 0, catalogGaps: 1, parserGaps: 0, partialRuns: 1
|
|
},
|
|
profiles: [{ version: 1, id: 'profile-1', name: 'Synthetic Windows', revision: 1, active: true, contextCount: 1 }],
|
|
evaluations: [], reviewItems: [],
|
|
actions: {
|
|
version: 1,
|
|
reprocess: [{
|
|
version: 1, id: 'reprocess-1', status: 'ready', artifactId: 'artifact-1',
|
|
identityAnalysisRunId: 'identity-1', expectedLatestProcessingRunId: 'processing-1', reasonCodes: []
|
|
}],
|
|
aggregate: [{
|
|
version: 1, id: 'aggregate-1', status: 'completed', environmentProfileId: 'profile-1',
|
|
sourceAnalysisRunIds: ['identity-1'], existingRunId: 'aggregation-1', reasonCodes: []
|
|
}],
|
|
evaluate: [{
|
|
version: 1, id: 'evaluate-1', status: 'review-only', environmentProfileId: 'profile-1',
|
|
aggregationRunId: 'aggregation-1', baselineAnalysisIds: ['baseline-analysis-1'],
|
|
reasonCodes: ['policy-action-baseline-analysis-partial']
|
|
}],
|
|
createFindings: [{
|
|
version: 1, id: 'findings-1', status: 'blocked', evaluationRunId: 'evaluation-1',
|
|
eligibleResultCount: 0, reasonCodes: ['policy-action-evaluation-blocked']
|
|
}]
|
|
}
|
|
} as PolicyAnalysisOverview;
|
|
|
|
describe('PolicyAnalysisActions', () => {
|
|
it('renders explicit workflow stages, review-only state, and blocked actions', () => {
|
|
const html = renderToStaticMarkup(<PolicyAnalysisActions projectId="project-1" overview={overview} onChanged={async () => undefined}/>);
|
|
expect(html).toContain('Create Environment Profile');
|
|
expect(html).toContain('Snapshot aggregation');
|
|
expect(html).toContain('Baseline evaluation');
|
|
expect(html).toContain('Finding Factory');
|
|
expect(html).toContain('Run as review-only');
|
|
expect(html).toContain('policy-action-baseline-analysis-partial');
|
|
expect(html).toContain('disabled=""');
|
|
});
|
|
});
|