chore: Fix types in tests 1/N.

This commit is contained in:
cpojer
2026-02-17 10:26:25 +09:00
parent 25126d75c3
commit 0cf443afe8
5 changed files with 135 additions and 90 deletions

View File

@@ -102,6 +102,7 @@ vi.mock("../../gateway/call.js", () => ({
callGateway: (opts: unknown) => callGatewayMock(opts),
}));
import type { HandleCommandsParams } from "./commands-types.js";
import { buildCommandContext, handleCommands } from "./commands.js";
// Avoid expensive workspace scans during /context tests.
@@ -504,6 +505,7 @@ describe("/compact command", () => {
...params,
sessionEntry: {
sessionId: "session-1",
updatedAt: Date.now(),
groupId: "group-1",
groupChannel: "#general",
space: "workspace-1",
@@ -651,7 +653,7 @@ function buildPolicyParams(
commandBody: string,
cfg: OpenClawConfig,
ctxOverrides?: Partial<MsgContext>,
) {
): HandleCommandsParams {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -670,7 +672,7 @@ function buildPolicyParams(
commandAuthorized: true,
});
return {
const params: HandleCommandsParams = {
ctx,
cfg,
command,
@@ -679,14 +681,15 @@ function buildPolicyParams(
sessionKey: "agent:main:main",
workspaceDir: "/tmp",
defaultGroupActivation: () => "mention",
resolvedVerboseLevel: "off" as const,
resolvedReasoningLevel: "off" as const,
resolvedVerboseLevel: "off",
resolvedReasoningLevel: "off",
resolveDefaultThinkingLevel: async () => undefined,
provider: "telegram",
model: "test-model",
contextTokens: 0,
isGroup: false,
};
return params;
}
describe("handleCommands /allowlist", () => {