mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:00:43 +00:00
test: tighten typing mode schema rejection
This commit is contained in:
@@ -13,7 +13,17 @@ describe("typing mode schema reuse", () => {
|
||||
});
|
||||
|
||||
it("rejects unsupported typingMode values for session and agent defaults", () => {
|
||||
expect(() => SessionSchema.parse({ typingMode: "always" })).toThrow();
|
||||
expect(() => AgentDefaultsSchema.parse({ typingMode: "soon" })).toThrow();
|
||||
const sessionResult = SessionSchema.safeParse({ typingMode: "always" });
|
||||
const agentDefaultsResult = AgentDefaultsSchema.safeParse({ typingMode: "soon" });
|
||||
|
||||
expect(sessionResult.success).toBe(false);
|
||||
expect(agentDefaultsResult.success).toBe(false);
|
||||
if (sessionResult.success || agentDefaultsResult.success) {
|
||||
throw new Error("Expected unsupported typingMode values to fail schema validation.");
|
||||
}
|
||||
expect(sessionResult.error.issues.map((issue) => issue.path.join("."))).toContain("typingMode");
|
||||
expect(agentDefaultsResult.error.issues.map((issue) => issue.path.join("."))).toContain(
|
||||
"typingMode",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user