fix(tests): restore ci type and format checks

This commit is contained in:
Nimrod Gutman
2026-04-12 14:13:57 +03:00
parent 90fac50987
commit 1fe14627a2
4 changed files with 24 additions and 28 deletions

View File

@@ -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,

View File

@@ -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",

View File

@@ -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",

View File

@@ -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();