mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
19 lines
816 B
TypeScript
19 lines
816 B
TypeScript
import { expect } from "vitest";
|
|
|
|
import { artifactInventoryResultSchema } from "../../../src/domain/artifactGraph.js";
|
|
import { artifactInspectionResultSchema } from "../../../src/domain/artifactInspection.js";
|
|
import { parseEvidence } from "../../../src/domain/evidence.js";
|
|
import type { CliResult } from "./cliResult.js";
|
|
|
|
/** Read the inspection and first inventory substep from a successful CLI response. */
|
|
export const readArtifactInspection = (response: CliResult) => {
|
|
expect(response.exitCode, response.stdout + response.stderr).toBe(0);
|
|
const inspection = artifactInspectionResultSchema.parse(
|
|
parseEvidence(response.json).normalized_result,
|
|
);
|
|
const graph = artifactInventoryResultSchema.parse(
|
|
inspection.substeps[0]?.evidence.normalized_result,
|
|
);
|
|
return { inspection, graph };
|
|
};
|