mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:01:25 +00:00
fix(hooks): backfill reset command hooks for native /new path
This commit is contained in:
committed by
Peter Steinberger
parent
bbdf895d42
commit
aec41a588b
@@ -890,6 +890,37 @@ describe("handleCommands hooks", () => {
|
||||
expect(spy).toHaveBeenCalledWith(expect.objectContaining({ type: "command", action: "new" }));
|
||||
spy.mockRestore();
|
||||
});
|
||||
|
||||
it("triggers hooks for native /new routed to target sessions", async () => {
|
||||
const cfg = {
|
||||
commands: { text: true },
|
||||
channels: { telegram: { allowFrom: ["*"] } },
|
||||
} as OpenClawConfig;
|
||||
const params = buildParams("/new", cfg, {
|
||||
Provider: "telegram",
|
||||
Surface: "telegram",
|
||||
CommandSource: "native",
|
||||
CommandTargetSessionKey: "agent:main:telegram:direct:123",
|
||||
SessionKey: "telegram:slash:123",
|
||||
SenderId: "123",
|
||||
From: "telegram:123",
|
||||
To: "slash:123",
|
||||
CommandAuthorized: true,
|
||||
});
|
||||
params.sessionKey = "agent:main:telegram:direct:123";
|
||||
const spy = vi.spyOn(internalHooks, "triggerInternalHook").mockResolvedValue();
|
||||
|
||||
await handleCommands(params);
|
||||
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: "command",
|
||||
action: "new",
|
||||
sessionKey: "agent:main:telegram:direct:123",
|
||||
}),
|
||||
);
|
||||
spy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
describe("handleCommands context", () => {
|
||||
|
||||
Reference in New Issue
Block a user