mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 22:50:43 +00:00
test: invoke auth and reply callbacks
This commit is contained in:
@@ -1358,11 +1358,13 @@ describe("dispatchReplyFromConfig", () => {
|
||||
opts?: GetReplyOptions,
|
||||
_cfg?: OpenClawConfig,
|
||||
) => {
|
||||
expect(requireToolResultHandler(opts?.onToolResult)).toEqual(expect.any(Function));
|
||||
const onToolResult = requireToolResultHandler(opts?.onToolResult);
|
||||
await onToolResult({ text: "tool output" });
|
||||
return { text: "hi" } satisfies ReplyPayload;
|
||||
};
|
||||
|
||||
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
|
||||
expect(dispatcher.sendToolResult).toHaveBeenCalledWith({ text: "tool output" });
|
||||
expect(dispatcher.sendFinalReply).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -547,7 +547,8 @@ describe("modelsAuthLoginCommand", () => {
|
||||
expect(ctx.env).toBe(process.env);
|
||||
expect(ctx.allowSecretRefPrompt).toBe(false);
|
||||
expect(ctx.isRemote).toBe(false);
|
||||
expect(ctx.openUrl).toEqual(expect.any(Function));
|
||||
await ctx.openUrl("https://example.com/auth");
|
||||
expect(mocks.openUrl).toHaveBeenCalledWith("https://example.com/auth");
|
||||
expect(ctx.oauth).toMatchObject({
|
||||
createVpsAwareHandlers: expect.any(Function),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user