mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:40:43 +00:00
test(commands): fix command fixture typing
This commit is contained in:
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
|
||||
import "./agent-command.test-mocks.js";
|
||||
import * as acpManagerModule from "../acp/control-plane/manager.js";
|
||||
import { AcpRuntimeError } from "../acp/runtime/errors.js";
|
||||
import * as embeddedModule from "../agents/pi-embedded.js";
|
||||
import * as configIoModule from "../config/io.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
@@ -401,9 +402,10 @@ describe("agentCommand ACP runtime routing", () => {
|
||||
return {
|
||||
kind: "stale",
|
||||
sessionKey,
|
||||
error: Object.assign(new Error(`ACP metadata is missing for session ${sessionKey}.`), {
|
||||
code: "ACP_SESSION_INIT_FAILED",
|
||||
}),
|
||||
error: new AcpRuntimeError(
|
||||
"ACP_SESSION_INIT_FAILED",
|
||||
`ACP metadata is missing for session ${sessionKey}.`,
|
||||
),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ vi.mock("../../config/plugin-auto-enable.js", () => ({
|
||||
|
||||
const resolveBundledPluginSources = vi.fn();
|
||||
const getChannelPluginCatalogEntry = vi.fn();
|
||||
const listChannelPluginCatalogEntries = vi.fn(() => []);
|
||||
const listChannelPluginCatalogEntries = vi.fn((..._args: unknown[]) => []);
|
||||
vi.mock("../../channels/plugins/catalog.js", () => {
|
||||
return {
|
||||
getChannelPluginCatalogEntry: (...args: unknown[]) => getChannelPluginCatalogEntry(...args),
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { RuntimeEnv } from "../runtime.js";
|
||||
import { captureEnv } from "../test-utils/env.js";
|
||||
|
||||
type RunMessageActionParams = {
|
||||
cfg?: unknown;
|
||||
action: string;
|
||||
params: Record<string, unknown>;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@ function createDefaultSessionStoreEntry() {
|
||||
cacheRead: 2_000,
|
||||
cacheWrite: 1_000,
|
||||
totalTokens: 5_000,
|
||||
totalTokensFresh: true as boolean,
|
||||
contextTokens: 10_000,
|
||||
model: "pi:opus",
|
||||
sessionId: "abc123",
|
||||
@@ -188,7 +189,11 @@ async function createStatusServiceSummary(
|
||||
}
|
||||
|
||||
function createSessionStatusRows() {
|
||||
const agents = mocks.listGatewayAgentsBasic().agents ?? [{ id: "main", name: "Main" }];
|
||||
const agents = (mocks.listGatewayAgentsBasic().agents ?? [
|
||||
{ id: "main", name: "Main" },
|
||||
]) as Array<{
|
||||
id: string;
|
||||
}>;
|
||||
const byAgent = agents.map((agent: { id: string }) => {
|
||||
const path = mocks.resolveStorePath("sessions", { agentId: agent.id });
|
||||
const store = mocks.loadSessionStore(path) as Record<
|
||||
@@ -198,7 +203,7 @@ function createSessionStatusRows() {
|
||||
const recent = Object.entries(store).map(([key, entry]) => {
|
||||
const contextTokens = typeof entry.contextTokens === "number" ? entry.contextTokens : null;
|
||||
const freshTotal =
|
||||
typeof entry.totalTokens === "number" && entry.totalTokensFresh !== false
|
||||
typeof entry.totalTokens === "number" && (entry.totalTokensFresh ?? true)
|
||||
? entry.totalTokens
|
||||
: null;
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user