test(ai): add stripResidualCombiners regression for mixed-type string|array collapse

This commit is contained in:
basedcorp99
2026-06-06 18:53:52 +02:00
parent f3210ab862
commit 2623bd75a2
@@ -728,6 +728,18 @@ describe("stripResidualCombiners", () => {
expect(normalized.anyOf).toBeUndefined();
expect(normalized.oneOf).toBeUndefined();
});
it("drops array-only keys when mixed-type collapse picks string from anyOf fixpoint", () => {
const stripped = stripResidualCombiners({
anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
description: "pr number, url, or branch",
}) as Record<string, unknown>;
expect(stripped.type).toBe("string");
expect(stripped.items).toBeUndefined();
expect(stripped.anyOf).toBeUndefined();
expect(stripped.description).toBe("pr number, url, or branch");
});
});
// ---------------------------------------------------------------------------