mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-24 12:59:33 +00:00
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
// Runtime plan tool-diagnostics tests cover the legacy provider diagnostic path
|
|
// used when no runtime plan owns tool schema diagnostics.
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
const mocks = vi.hoisted(() => ({
|
|
logProviderToolSchemaDiagnostics: vi.fn(),
|
|
normalizeProviderToolSchemas: vi.fn((params: { tools: unknown[] }) => params.tools),
|
|
}));
|
|
|
|
vi.mock("../embedded-agent-runner/tool-schema-runtime.js", () => ({
|
|
logProviderToolSchemaDiagnostics: mocks.logProviderToolSchemaDiagnostics,
|
|
normalizeProviderToolSchemas: mocks.normalizeProviderToolSchemas,
|
|
}));
|
|
|
|
const { logAgentRuntimeToolDiagnostics } = await import("./tools.js");
|
|
|
|
describe("AgentRuntimePlan tool diagnostics legacy fallback", () => {
|
|
it("falls back to provider diagnostics when no RuntimePlan is available", () => {
|
|
const tools = [{ name: "alpha" }] as never;
|
|
|
|
logAgentRuntimeToolDiagnostics({
|
|
tools,
|
|
provider: "openai",
|
|
modelId: "gpt-5.4",
|
|
modelApi: "openai-responses",
|
|
workspaceDir: "/tmp/openclaw-runtime-plan-tools",
|
|
});
|
|
|
|
expect(mocks.logProviderToolSchemaDiagnostics).toHaveBeenCalledTimes(1);
|
|
expect(mocks.logProviderToolSchemaDiagnostics.mock.calls.at(0)?.[0]).toEqual({
|
|
tools,
|
|
provider: "openai",
|
|
config: undefined,
|
|
workspaceDir: "/tmp/openclaw-runtime-plan-tools",
|
|
env: process.env,
|
|
modelId: "gpt-5.4",
|
|
modelApi: "openai-responses",
|
|
model: undefined,
|
|
});
|
|
});
|
|
});
|