fix(json): consolidate dictionary admission across analysis and verification

This commit is contained in:
morluto committed 2026-10-26 18:14:50 +08:00
1 parent c06dc2d356
commit e7f986c994
18 files changed
+369 -99

No files matched your search

@@ -114,3 +114,30 @@ it("parses explicit per-path expectations without borrowing the production phase
}).success,
).toBe(false);
});
it("retains prototype-named source paths in independent expectations", () => {
const input = Object.fromEntries([
["__proto__", expected],
["constructor", expected],
]);
const parsed = structuredScopeExpectationsSchema.parse(input);
expect(Object.keys(parsed)).toEqual(["__proto__", "constructor"]);
expect(Object.hasOwn(parsed, "__proto__")).toBe(true);
expect(parsed["__proto__"]).toEqual(expected);
});
it("validates prototype-named expectations and retains the nonempty path policy", () => {
for (const entry of [
null,
{ ...expected, operation: "wrong" },
{ ...expected, analysis_status: "wrong" },
])
expect(
structuredScopeExpectationsSchema.safeParse(
Object.fromEntries([["__proto__", entry]]),
).success,
).toBe(false);
expect(
structuredScopeExpectationsSchema.safeParse({ "": expected }).success,
).toBe(false);
});