mirror of
https://github.com/morluto/rea.git
synced 2026-10-11 21:39:55 +00:00
test(evidence): cover workflow question whitespace normalization (#1739)
This commit is contained in:
@@ -46,6 +46,63 @@ describe("workflow residual question retention", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["spaces", " Which boundary? "],
|
||||
["line feed and tab", "\nWhich boundary?\t"],
|
||||
["byte order mark", "\uFEFFWhich boundary?\uFEFF"],
|
||||
])(
|
||||
"normalizes edge whitespace from %s without changing workflow Evidence",
|
||||
(_, question) => {
|
||||
const records = new InvestigationRecords();
|
||||
const result = { residual_unknowns: [question] };
|
||||
const evidence = createWorkflowEvidence({
|
||||
target: undefined,
|
||||
operation: "inspect_native_api",
|
||||
parameters: {},
|
||||
result,
|
||||
upstreamProfile: undefined,
|
||||
});
|
||||
|
||||
expect(records.recordEvidence(evidence).ok).toBe(true);
|
||||
expect(
|
||||
recordWorkflowUnknowns({
|
||||
name: "inspect_native_api",
|
||||
result,
|
||||
evidenceId: evidence.evidence_id,
|
||||
recordUnknown: (unknown) => records.recordUnknown(unknown),
|
||||
}).ok,
|
||||
).toBe(true);
|
||||
expect(records.listUnknowns()).toMatchObject([
|
||||
{ question: "Which boundary?" },
|
||||
]);
|
||||
expect(evidence.normalized_result).toEqual(result);
|
||||
},
|
||||
);
|
||||
|
||||
it("rejects questions that are empty after whitespace normalization", () => {
|
||||
const records = new InvestigationRecords();
|
||||
const result = { residual_unknowns: [" \n\t "] };
|
||||
const evidence = createWorkflowEvidence({
|
||||
target: undefined,
|
||||
operation: "inspect_native_api",
|
||||
parameters: {},
|
||||
result,
|
||||
upstreamProfile: undefined,
|
||||
});
|
||||
|
||||
expect(records.recordEvidence(evidence).ok).toBe(true);
|
||||
expect(
|
||||
recordWorkflowUnknowns({
|
||||
name: "inspect_native_api",
|
||||
result,
|
||||
evidenceId: evidence.evidence_id,
|
||||
recordUnknown: (unknown) => records.recordUnknown(unknown),
|
||||
}).ok,
|
||||
).toBe(false);
|
||||
expect(records.listUnknowns()).toEqual([]);
|
||||
expect(evidence.normalized_result).toEqual(result);
|
||||
});
|
||||
|
||||
it("preserves registry failures rather than presenting a completed workflow", () => {
|
||||
const error = new UnknownRegistryError("limit");
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user