test(skill-workshop): pin disabled hook wiring · openclaw/openclaw@1704dce
vincentkoc
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,6 +51,21 @@ function createProposal(
|
51 | 51 | } |
52 | 52 | |
53 | 53 | describe("skill-workshop", () => { |
| 54 | +it("does not register hooks or tools when disabled", () => { |
| 55 | +const on = vi.fn(); |
| 56 | +const registerTool = vi.fn(); |
| 57 | +const api = createTestPluginApi({ |
| 58 | +pluginConfig: { enabled: false }, |
| 59 | + on, |
| 60 | + registerTool, |
| 61 | +}); |
| 62 | + |
| 63 | +plugin.register(api); |
| 64 | + |
| 65 | +expect(registerTool).not.toHaveBeenCalled(); |
| 66 | +expect(on).not.toHaveBeenCalled(); |
| 67 | +}); |
| 68 | + |
54 | 69 | it("detects user corrections and creates an animated GIF proposal", async () => { |
55 | 70 | const workspaceDir = await makeTempDir(); |
56 | 71 | const proposal = createProposalFromMessages({ |
@@ -198,6 +213,19 @@ describe("skill-workshop", () => {
|
198 | 213 | }); |
199 | 214 | }); |
200 | 215 | |
| 216 | +it("skips agent_end hook wiring when auto-capture is disabled", () => { |
| 217 | +const on = vi.fn(); |
| 218 | +const api = createTestPluginApi({ |
| 219 | +pluginConfig: { autoCapture: false }, |
| 220 | + on, |
| 221 | +}); |
| 222 | + |
| 223 | +plugin.register(api); |
| 224 | + |
| 225 | +expect(on).toHaveBeenCalledWith("before_prompt_build", expect.any(Function)); |
| 226 | +expect(on).not.toHaveBeenCalledWith("agent_end", expect.any(Function)); |
| 227 | +}); |
| 228 | + |
201 | 229 | it("lets explicit tool suggestions stay pending in auto mode", async () => { |
202 | 230 | const workspaceDir = await makeTempDir(); |
203 | 231 | const stateDir = await makeTempDir(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。