mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 10:51:23 +00:00
chore: Fix types in tests 1/N.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import type { MsgContext } from "../templating.js";
|
||||
import type { HandleCommandsParams } from "./commands-types.js";
|
||||
import { buildCommandContext } from "./commands.js";
|
||||
import { parseInlineDirectives } from "./directive-handling.js";
|
||||
|
||||
@@ -10,7 +11,7 @@ export function buildCommandTestParams(
|
||||
options?: {
|
||||
workspaceDir?: string;
|
||||
},
|
||||
) {
|
||||
): HandleCommandsParams {
|
||||
const ctx = {
|
||||
Body: commandBody,
|
||||
CommandBody: commandBody,
|
||||
@@ -29,7 +30,7 @@ export function buildCommandTestParams(
|
||||
commandAuthorized: true,
|
||||
});
|
||||
|
||||
return {
|
||||
const params: HandleCommandsParams = {
|
||||
ctx,
|
||||
cfg,
|
||||
command,
|
||||
@@ -38,12 +39,13 @@ export function buildCommandTestParams(
|
||||
sessionKey: "agent:main:main",
|
||||
workspaceDir: options?.workspaceDir ?? "/tmp",
|
||||
defaultGroupActivation: () => "mention",
|
||||
resolvedVerboseLevel: "off" as const,
|
||||
resolvedReasoningLevel: "off" as const,
|
||||
resolvedVerboseLevel: "off",
|
||||
resolvedReasoningLevel: "off",
|
||||
resolveDefaultThinkingLevel: async () => undefined,
|
||||
provider: "whatsapp",
|
||||
model: "test-model",
|
||||
contextTokens: 0,
|
||||
isGroup: false,
|
||||
};
|
||||
return params;
|
||||
}
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user