mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:40:43 +00:00
fix(tests): restore ci type and format checks
This commit is contained in:
@@ -1053,15 +1053,11 @@ describe("wrapStreamFnSanitizeMalformedToolCalls", () => {
|
||||
createFakeStream({ events: [], resultMessage: { role: "assistant", content: [] } }),
|
||||
);
|
||||
|
||||
const wrapped = wrapStreamFnSanitizeMalformedToolCalls(
|
||||
baseFn as never,
|
||||
new Set(["read"]),
|
||||
{
|
||||
validateAnthropicTurns: true,
|
||||
preserveSignatures: true,
|
||||
dropThinkingBlocks: false,
|
||||
} as never,
|
||||
);
|
||||
const wrapped = wrapStreamFnSanitizeMalformedToolCalls(baseFn as never, new Set(["read"]), {
|
||||
validateAnthropicTurns: true,
|
||||
preserveSignatures: true,
|
||||
dropThinkingBlocks: false,
|
||||
} as never);
|
||||
const stream = wrapped(
|
||||
{ api: "anthropic-messages" } as never,
|
||||
{ messages } as never,
|
||||
|
||||
@@ -108,10 +108,9 @@ describe("sanitizeToolCallInputs redacts sessions_spawn attachments", () => {
|
||||
input?: { attachments?: unknown[] };
|
||||
arguments?: { attachments?: unknown[] };
|
||||
} | null;
|
||||
const attachment =
|
||||
(tool?.input?.attachments?.[0] ?? tool?.arguments?.attachments?.[0] ?? null) as
|
||||
| Record<string, unknown>
|
||||
| null;
|
||||
const attachment = (tool?.input?.attachments?.[0] ??
|
||||
tool?.arguments?.attachments?.[0] ??
|
||||
null) as Record<string, unknown> | null;
|
||||
expect(attachment).toEqual({
|
||||
name: "payload.json",
|
||||
mimeType: "application/json",
|
||||
|
||||
@@ -17,7 +17,9 @@ const {
|
||||
} = vi.hoisted(() => ({
|
||||
enqueueSystemEventMock: vi.fn(),
|
||||
requestHeartbeatNowMock: vi.fn(),
|
||||
runHeartbeatOnceMock: vi.fn(async () => ({ status: "ran" as const, durationMs: 1 })),
|
||||
runHeartbeatOnceMock: vi.fn<
|
||||
(...args: unknown[]) => Promise<{ status: "ran"; durationMs: number }>
|
||||
>(async () => ({ status: "ran", durationMs: 1 })),
|
||||
loadConfigMock: vi.fn(),
|
||||
fetchWithSsrFGuardMock: vi.fn(),
|
||||
runCronIsolatedAgentTurnMock: vi.fn(async () => ({ status: "ok" as const, summary: "ok" })),
|
||||
@@ -401,17 +403,19 @@ describe("buildGatewayCronService", () => {
|
||||
broadcast: () => {},
|
||||
});
|
||||
try {
|
||||
const cronDeps = (state.cron as unknown as {
|
||||
state?: {
|
||||
deps?: {
|
||||
runHeartbeatOnce?: (opts?: {
|
||||
agentId?: string;
|
||||
sessionKey?: string | null;
|
||||
heartbeat?: Record<string, unknown>;
|
||||
}) => Promise<unknown>;
|
||||
const cronDeps = (
|
||||
state.cron as unknown as {
|
||||
state?: {
|
||||
deps?: {
|
||||
runHeartbeatOnce?: (opts?: {
|
||||
agentId?: string;
|
||||
sessionKey?: string | null;
|
||||
heartbeat?: Record<string, unknown>;
|
||||
}) => Promise<unknown>;
|
||||
};
|
||||
};
|
||||
};
|
||||
}).state?.deps;
|
||||
}
|
||||
).state?.deps;
|
||||
await cronDeps?.runHeartbeatOnce?.({
|
||||
agentId: "yinze",
|
||||
sessionKey: "agent:yinze:main",
|
||||
|
||||
@@ -8,10 +8,7 @@ import {
|
||||
setupTelegramHeartbeatPluginRuntimeForTests,
|
||||
withTempHeartbeatSandbox,
|
||||
} from "./heartbeat-runner.test-utils.js";
|
||||
import {
|
||||
enqueueSystemEvent,
|
||||
resetSystemEventsForTest,
|
||||
} from "./system-events.js";
|
||||
import { enqueueSystemEvent, resetSystemEventsForTest } from "./system-events.js";
|
||||
|
||||
beforeEach(() => {
|
||||
setupTelegramHeartbeatPluginRuntimeForTests();
|
||||
|
||||
Reference in New Issue
Block a user