From b56e4f457c3bf0918fa54de74e85d56fa804f5cb Mon Sep 17 00:00:00 2001 From: Shakker Date: Sat, 9 May 2026 21:41:16 +0100 Subject: [PATCH] test: speed up agent command tests --- src/commands/agent.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/commands/agent.test.ts b/src/commands/agent.test.ts index 1f0392f9c2b..103c564903e 100644 --- a/src/commands/agent.test.ts +++ b/src/commands/agent.test.ts @@ -9,6 +9,7 @@ import * as attemptExecutionRuntime from "../agents/command/attempt-execution.ru import { loadManifestModelCatalog, loadModelCatalog } from "../agents/model-catalog.js"; import * as modelSelectionModule from "../agents/model-selection.js"; import { runEmbeddedPiAgent } from "../agents/pi-embedded.js"; +import { BASE_THINKING_LEVELS } from "../auto-reply/thinking.shared.js"; import * as runtimeSnapshotModule from "../config/runtime-snapshot.js"; import { clearSessionStoreCacheForTest } from "../config/sessions/store.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; @@ -18,7 +19,10 @@ import { resetAgentEventsForTest, resetAgentRunContextForTest, } from "../infra/agent-events.js"; +import type { PluginProviderRegistration } from "../plugins/registry.js"; +import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js"; import type { RuntimeEnv } from "../runtime.js"; +import { createTestRegistry } from "../test-utils/channel-plugins.js"; import { agentCommand, agentCommandFromIngress } from "./agent.js"; import { createThrowingTestRuntime } from "./test-runtime-config-helpers.js"; @@ -321,8 +325,30 @@ function mockModelCatalogOnce(entries: ReturnType ({ + pluginId: providerId, + source: "test", + provider: { + id: providerId, + label: providerId, + auth: [], + resolveThinkingProfile: () => ({ + levels: BASE_THINKING_LEVELS.map((id) => ({ id })), + defaultLevel: "off", + }), + }, + }), + ); + setActivePluginRegistry(registry); +} + beforeEach(() => { vi.clearAllMocks(); + resetPluginRuntimeStateForTest(); + installThinkingTestProviders(); clearSessionStoreCacheForTest(); resetAgentEventsForTest(); resetAgentRunContextForTest();