Assessor_2.0/tests/client-information-fixture.ts

22 lines
2.3 KiB
TypeScript

import type { EnvironmentObservation, EnvironmentSnapshot, ScannerReportSection } from '../src/domain/environment-context';
export function clientInformationFixture(): EnvironmentSnapshot {
const tool = { id: 'synthetic', name: 'Synthetic scanner' };
const observation = (id: string, property: string, value: string | number | boolean, state: EnvironmentObservation['state'] = 'observed'): EnvironmentObservation => ({
version: 1, id, property, label: id, originalValue: value, valueType: typeof value as 'string' | 'number' | 'boolean',
state, scanRunId: 'run-1', importFileId: 'file-1', tool, subject: { type: 'domain', identity: 'object-1' },
observedAt: '2026-10-01T10:00:00Z', sectionKey: 'directory', source: { rowIndex: 0 }, mappingVersion: '1', attributes: {}
});
const section: ScannerReportSection = { version: 1, id: 'section-1', sectionKey: 'directory', label: 'Original directory',
scanRunId: 'run-1', importFileId: 'file-1', tool, ordinal: 0, state: 'observed', source: { objectPath: 'synthetic.section' }, extractorVersion: '1',
tables: [{ name: 'Native directory table', presentation: 'inline', headers: ['Setting', 'Value'], rows: [['Native setting', false]] }], attributes: {} };
return { version: 1, projectId: 'client-1', assessmentId: 'slot-1', scanRunIds: ['run-1'], generatedAt: '2026-10-04T10:00:00Z',
observations: [observation('Domain name', 'domain.fqdn', 'synthetic.invalid'), observation('Flag', 'domain.flag', false),
observation('Zero', 'domain.count', 0), { ...observation('Conflicting name', 'domain.fqdn', 'other.invalid'), importFileId: 'file-2' },
{ ...observation('MFA source', 'cloud.authentication.eidsca.af01.reported_evidence', 'Your tenant is configured as **enabled**.\n\nThe recommended value is **\'enabled\'** for **policies/authenticationMethodsPolicy/authenticationMethodConfigurations(\'Fido2\')**'),
tool: { id: 'maester', name: 'Maester' }, sectionKey: undefined,
attributes: { sourceRuleId: 'EIDSCA.AF01', informationKind: 'reported-test-evidence', clientInformationArea: 'cloud-access', inventoryComplete: false } },
observation('Restricted', 'source.private', '', 'access-denied')], sections: [section],
coverage: { observed: 6, empty: 0, explicitlyAbsent: 0, restricted: 1, incomplete: 0 } };
}