refactor(test): keep coverage at behavioral boundaries (#474)

* refactor(test): keep coverage at behavioral boundaries

* fix(ci): restore package workflow temp-root classification
This commit is contained in:
morluto
2026-08-11 18:34:32 +08:00
committed by GitHub
parent d65730c4c2
commit d4dc940bd8
117 changed files with 1519 additions and 2419 deletions
+42
View File
@@ -0,0 +1,42 @@
import {
compareProcessCaptures,
parseProcessCapture,
processCaptureSchema,
type UnverifiedProcessCapture,
} from "./processCapture.js";
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
export { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
/** Parse a detached valid empty capture for tests that need trusted evidence. */
export const emptyProcessCapture = () =>
parseProcessCapture(EMPTY_PROCESS_CAPTURE_EXAMPLE);
/** Parse a mutable unverified capture for boundary-validation tests. */
export const emptyUnverifiedProcessCapture = (): UnverifiedProcessCapture =>
processCaptureSchema.parse(EMPTY_PROCESS_CAPTURE_EXAMPLE);
/** Project validation failures without coupling tests to Zod internals. */
export const processCaptureIssues = (
capture: UnverifiedProcessCapture,
): readonly { readonly path: string; readonly message: string }[] => {
const parsed = processCaptureSchema.safeParse(capture);
return parsed.success
? []
: parsed.error.issues.map((issue) => ({
path: issue.path.join("."),
message: issue.message,
}));
};
/** Compare unverified fixture values through the production parser. */
export const compareUnverifiedProcessCaptures = (
left: UnverifiedProcessCapture,
right: UnverifiedProcessCapture,
options?: Parameters<typeof compareProcessCaptures>[2],
): ReturnType<typeof compareProcessCaptures> =>
compareProcessCaptures(
parseProcessCapture(left),
parseProcessCapture(right),
options,
);