Assessor_2.0/tests/fixtures/policy-current-runs.ts

27 lines
1.7 KiB
TypeScript

import { POLICY_EVALUATION_ENGINE, type StoredPolicyEvaluation } from '../../src/domain/policy-evaluation';
/** Synthetic only; repeated baseline generations must not count as extra coverage. */
export function policyRun(id: string, baselineIds: (string | undefined)[], references: number, day: number,
aggregation = 'synthetic-aggregation'): StoredPolicyEvaluation {
return {
version: 1,
run: { id, projectId: 'synthetic', aggregationRunId: aggregation, evaluator: POLICY_EVALUATION_ENGINE,
completedAt: `2026-09-${String(day).padStart(2, '0')}T00:00:00.000Z`,
baselineAnalysisIds: Array.from({ length: references }, (_, index) => `${id}-analysis-${index}`) },
results: baselineIds.map((baselineId, index) => ({
id: `${id}-result-${index}`, evaluationRunId: id, baselineId, baselineLabel: baselineId,
baselineAnalysisId: `${id}-analysis-${index}`, baselineState: 'explicit-recommendation',
customerState: 'configured', classification: 'confirmed_configured_deviation', observationIds: [], diagnosticCodes: [],
identity: { id: 'synthetic-setting', scope: 'computer', admx: { status: 'not-found' }, target: { kind: 'registry-value',
hive: 'HKEY_LOCAL_MACHINE', key: 'Software\\Policies\\Synthetic', valueName: id } },
comparator: { version: 1, comparator: { kind: 'equality' }, relation: 'different',
actual: { kind: 'integer', value: '0' }, baseline: { kind: 'integer', value: '1' }, diagnosticCodes: [] }
})), evidence: []
} as unknown as StoredPolicyEvaluation;
}
export const repeatedBaselineRuns = () => [
policyRun('older-repeated', ['alpha', 'beta', 'alpha', 'beta'], 4, 17),
policyRun('newer-distinct', ['alpha', 'beta'], 2, 18)
];