- agent: 6 auto-collecting registries (parsers/checks/risk/scoring/tools/pipelines); 15 doc parsers, 12 check packs, 6 risk models, scoring dimensions + reconciler, ~15 Claude tools, 8 pipelines (financing/underwriting/dpp/compliance/grading/esg) + routes; 380 tests - infra: BaseRepository + ~35 typed repositories, 56 composed schema modules, storage/queue/notifications/cache/events adapters; 203 tests - pnpm -r typecheck/build/test all green Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/**
|
|
* Shared helpers for the domain cross-check pack tests. Offline-only: builds
|
|
* `ParsedDocument`s and runs a pack's checks against a `CrossCheckInput`.
|
|
*/
|
|
import type { CrossCheck } from '../src/checks/registry.js';
|
|
import type {
|
|
CrossCheckInput,
|
|
DocumentType,
|
|
ParsedDocument,
|
|
ParsedDocumentFields,
|
|
} from '../src/domain/types.js';
|
|
import type { Finding } from '../src/shared.js';
|
|
import { sampleProvenance, invoiceDoc } from './helpers.js';
|
|
|
|
/** Build a parsed document of any type with the given fields. */
|
|
export const makeDoc = (
|
|
docType: DocumentType,
|
|
fields: ParsedDocumentFields = {},
|
|
over: Partial<ParsedDocument> = {},
|
|
): ParsedDocument => ({
|
|
index: 0,
|
|
name: `${docType}.pdf`,
|
|
docType,
|
|
sha256: 'f'.repeat(64),
|
|
fields,
|
|
...over,
|
|
});
|
|
|
|
/** Run every check in a pack and flatten the findings (registration order). */
|
|
export const runPack = (
|
|
pack: readonly CrossCheck[],
|
|
input: CrossCheckInput,
|
|
): Finding[] => pack.flatMap((c) => c.run(input));
|
|
|
|
export const codesOf = (findings: readonly Finding[]): string[] =>
|
|
findings.map((f) => f.code);
|
|
|
|
/** A minimal, clean commercial input every pack must be silent on. */
|
|
export const cleanInput = (): CrossCheckInput => ({
|
|
provenance: sampleProvenance(),
|
|
documents: [invoiceDoc()],
|
|
});
|