mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-04-30 14:02:56 +08:00
test(gateway): share plugin approval no-route context
This commit is contained in:
@@ -32,6 +32,14 @@ function createMockOptions(
|
||||
} as unknown as GatewayRequestHandlerOptions;
|
||||
}
|
||||
|
||||
function createNoExecApprovalContext(): GatewayRequestHandlerOptions["context"] {
|
||||
return {
|
||||
broadcast: vi.fn(),
|
||||
logGateway: { error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() },
|
||||
hasExecApprovalClients: () => false,
|
||||
} as unknown as GatewayRequestHandlerOptions["context"];
|
||||
}
|
||||
|
||||
describe("createPluginApprovalHandlers", () => {
|
||||
let manager: ExecApprovalManager<PluginApprovalRequestPayload>;
|
||||
|
||||
@@ -126,11 +134,7 @@ describe("createPluginApprovalHandlers", () => {
|
||||
description: "Desc",
|
||||
},
|
||||
{
|
||||
context: {
|
||||
broadcast: vi.fn(),
|
||||
logGateway: { error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() },
|
||||
hasExecApprovalClients: () => false,
|
||||
} as unknown as GatewayRequestHandlerOptions["context"],
|
||||
context: createNoExecApprovalContext(),
|
||||
},
|
||||
);
|
||||
await handlers["plugin.approval.request"](opts);
|
||||
@@ -294,11 +298,7 @@ describe("createPluginApprovalHandlers", () => {
|
||||
"plugin.approval.request",
|
||||
{ title: "T", description: "D" },
|
||||
{
|
||||
context: {
|
||||
broadcast: vi.fn(),
|
||||
logGateway: { error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() },
|
||||
hasExecApprovalClients: () => false,
|
||||
} as unknown as GatewayRequestHandlerOptions["context"],
|
||||
context: createNoExecApprovalContext(),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user