test: invoke auth and reply callbacks · openclaw/openclaw@03c41ea
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1358,11 +1358,13 @@ describe("dispatchReplyFromConfig", () => {
|
1358 | 1358 | opts?: GetReplyOptions, |
1359 | 1359 | _cfg?: OpenClawConfig, |
1360 | 1360 | ) => { |
1361 | | -expect(requireToolResultHandler(opts?.onToolResult)).toEqual(expect.any(Function)); |
| 1361 | +const onToolResult = requireToolResultHandler(opts?.onToolResult); |
| 1362 | +await onToolResult({ text: "tool output" }); |
1362 | 1363 | return { text: "hi" } satisfies ReplyPayload; |
1363 | 1364 | }; |
1364 | 1365 | |
1365 | 1366 | await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver }); |
| 1367 | +expect(dispatcher.sendToolResult).toHaveBeenCalledWith({ text: "tool output" }); |
1366 | 1368 | expect(dispatcher.sendFinalReply).toHaveBeenCalledTimes(1); |
1367 | 1369 | }); |
1368 | 1370 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -547,7 +547,8 @@ describe("modelsAuthLoginCommand", () => {
|
547 | 547 | expect(ctx.env).toBe(process.env); |
548 | 548 | expect(ctx.allowSecretRefPrompt).toBe(false); |
549 | 549 | expect(ctx.isRemote).toBe(false); |
550 | | -expect(ctx.openUrl).toEqual(expect.any(Function)); |
| 550 | +await ctx.openUrl("https://example.com/auth"); |
| 551 | +expect(mocks.openUrl).toHaveBeenCalledWith("https://example.com/auth"); |
551 | 552 | expect(ctx.oauth).toMatchObject({ |
552 | 553 | createVpsAwareHandlers: expect.any(Function), |
553 | 554 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。