test: tighten twitch setup validation assertions · openclaw/openclaw@535d70c
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -113,11 +113,11 @@ describe("setup surface helpers", () => {
|
113 | 113 | const result = await promptUsername(mockPrompter, null); |
114 | 114 | |
115 | 115 | expect(result).toBe("mybot"); |
116 | | -expect(mockPromptText).toHaveBeenCalledWith({ |
117 | | - message: "Twitch bot username", |
118 | | - initialValue: "", |
119 | | - validate: expect.any(Function), |
120 | | -}); |
| 116 | +const promptArgs = mockPromptText.mock.calls[0]?.[0]; |
| 117 | +expect(promptArgs?.message).toBe("Twitch bot username"); |
| 118 | +expect(promptArgs?.initialValue).toBe(""); |
| 119 | +expect(promptArgs?.validate?.("")).toBe("Required"); |
| 120 | +expect(promptArgs?.validate?.("mybot")).toBeUndefined(); |
121 | 121 | }); |
122 | 122 | }); |
123 | 123 | |
@@ -128,11 +128,11 @@ describe("setup surface helpers", () => {
|
128 | 128 | const result = await promptClientId(mockPrompter, null); |
129 | 129 | |
130 | 130 | expect(result).toBe("abc123xyz"); |
131 | | -expect(mockPromptText).toHaveBeenCalledWith({ |
132 | | - message: "Twitch Client ID", |
133 | | - initialValue: "", |
134 | | - validate: expect.any(Function), |
135 | | -}); |
| 131 | +const promptArgs = mockPromptText.mock.calls[0]?.[0]; |
| 132 | +expect(promptArgs?.message).toBe("Twitch Client ID"); |
| 133 | +expect(promptArgs?.initialValue).toBe(""); |
| 134 | +expect(promptArgs?.validate?.("")).toBe("Required"); |
| 135 | +expect(promptArgs?.validate?.("abc123xyz")).toBeUndefined(); |
136 | 136 | }); |
137 | 137 | }); |
138 | 138 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。