test: tighten typing mode schema rejection · openclaw/openclaw@92ffb4a
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,17 @@ describe("typing mode schema reuse", () => {
|
13 | 13 | }); |
14 | 14 | |
15 | 15 | it("rejects unsupported typingMode values for session and agent defaults", () => { |
16 | | -expect(() => SessionSchema.parse({ typingMode: "always" })).toThrow(); |
17 | | -expect(() => AgentDefaultsSchema.parse({ typingMode: "soon" })).toThrow(); |
| 16 | +const sessionResult = SessionSchema.safeParse({ typingMode: "always" }); |
| 17 | +const agentDefaultsResult = AgentDefaultsSchema.safeParse({ typingMode: "soon" }); |
| 18 | + |
| 19 | +expect(sessionResult.success).toBe(false); |
| 20 | +expect(agentDefaultsResult.success).toBe(false); |
| 21 | +if (sessionResult.success || agentDefaultsResult.success) { |
| 22 | +throw new Error("Expected unsupported typingMode values to fail schema validation."); |
| 23 | +} |
| 24 | +expect(sessionResult.error.issues.map((issue) => issue.path.join("."))).toContain("typingMode"); |
| 25 | +expect(agentDefaultsResult.error.issues.map((issue) => issue.path.join("."))).toContain( |
| 26 | +"typingMode", |
| 27 | +); |
18 | 28 | }); |
19 | 29 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。