mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 07:50:21 +00:00
Refactor channel approval capability seams (#58634)
Merged via squash.
Prepared head SHA: c9ad4e4706
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
d9a7ffe003
commit
c87c8e66bf
@@ -243,6 +243,34 @@ describe("TelegramExecApprovalHandler", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("delivers plugin approvals when the agent only exists in the Telegram session key", async () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
telegram: {
|
||||
execApprovals: {
|
||||
enabled: true,
|
||||
approvers: ["8460800771"],
|
||||
agentFilter: ["main"],
|
||||
target: "dm",
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
const { handler, sendMessage } = createHandler(cfg);
|
||||
|
||||
await handler.handleRequested({
|
||||
...pluginRequest,
|
||||
request: {
|
||||
...pluginRequest.request,
|
||||
agentId: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
const [chatId, text] = sendMessage.mock.calls[0] ?? [];
|
||||
expect(chatId).toBe("8460800771");
|
||||
expect(text).toContain("Plugin approval required");
|
||||
});
|
||||
|
||||
it("does not deliver plugin approvals for a different Telegram account", async () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
|
||||
Reference in New Issue
Block a user