mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 19:11:23 +00:00
chore: Fix types in tests 29/N.
This commit is contained in:
@@ -43,7 +43,7 @@ function mockConfig(
|
||||
home: string,
|
||||
storePath: string,
|
||||
agentOverrides?: Partial<NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]>>,
|
||||
telegramOverrides?: Partial<NonNullable<OpenClawConfig["telegram"]>>,
|
||||
telegramOverrides?: Partial<NonNullable<NonNullable<OpenClawConfig["channels"]>["telegram"]>>,
|
||||
agentsList?: Array<{ id: string; default?: boolean }>,
|
||||
) {
|
||||
configSpy.mockReturnValue({
|
||||
@@ -57,7 +57,9 @@ function mockConfig(
|
||||
list: agentsList,
|
||||
},
|
||||
session: { store: storePath, mainKey: "main" },
|
||||
telegram: telegramOverrides ? { ...telegramOverrides } : undefined,
|
||||
channels: {
|
||||
telegram: telegramOverrides ? { ...telegramOverrides } : undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -342,7 +344,7 @@ describe("agentCommand", () => {
|
||||
|
||||
await agentCommand({ message: "hi", to: "+1999", json: true }, runtime);
|
||||
|
||||
const logged = (runtime.log as MockInstance).mock.calls.at(-1)?.[0] as string;
|
||||
const logged = (runtime.log as unknown as MockInstance).mock.calls.at(-1)?.[0] as string;
|
||||
const parsed = JSON.parse(logged) as {
|
||||
payloads: Array<{ text: string; mediaUrl?: string | null }>;
|
||||
meta: { durationMs: number };
|
||||
@@ -376,6 +378,7 @@ describe("agentCommand", () => {
|
||||
const deps = {
|
||||
sendMessageWhatsApp: vi.fn(),
|
||||
sendMessageTelegram: vi.fn().mockResolvedValue({ messageId: "t1", chatId: "123" }),
|
||||
sendMessageSlack: vi.fn(),
|
||||
sendMessageDiscord: vi.fn(),
|
||||
sendMessageSignal: vi.fn(),
|
||||
sendMessageIMessage: vi.fn(),
|
||||
|
||||
@@ -29,22 +29,22 @@ vi.mock("../web/session.js", () => ({
|
||||
webAuthExists,
|
||||
}));
|
||||
|
||||
const handleDiscordAction = vi.fn(async () => ({ details: { ok: true } }));
|
||||
const handleDiscordAction = vi.fn(async (..._args: unknown[]) => ({ details: { ok: true } }));
|
||||
vi.mock("../agents/tools/discord-actions.js", () => ({
|
||||
handleDiscordAction,
|
||||
}));
|
||||
|
||||
const handleSlackAction = vi.fn(async () => ({ details: { ok: true } }));
|
||||
const handleSlackAction = vi.fn(async (..._args: unknown[]) => ({ details: { ok: true } }));
|
||||
vi.mock("../agents/tools/slack-actions.js", () => ({
|
||||
handleSlackAction,
|
||||
}));
|
||||
|
||||
const handleTelegramAction = vi.fn(async () => ({ details: { ok: true } }));
|
||||
const handleTelegramAction = vi.fn(async (..._args: unknown[]) => ({ details: { ok: true } }));
|
||||
vi.mock("../agents/tools/telegram-actions.js", () => ({
|
||||
handleTelegramAction,
|
||||
}));
|
||||
|
||||
const handleWhatsAppAction = vi.fn(async () => ({ details: { ok: true } }));
|
||||
const handleWhatsAppAction = vi.fn(async (..._args: unknown[]) => ({ details: { ok: true } }));
|
||||
vi.mock("../agents/tools/whatsapp-actions.js", () => ({
|
||||
handleWhatsAppAction,
|
||||
}));
|
||||
|
||||
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { OAuthCredentials } from "@mariozechner/pi-ai";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
applyAuthProfileConfig,
|
||||
applyLitellmProviderConfig,
|
||||
@@ -36,12 +37,12 @@ import {
|
||||
|
||||
function createLegacyProviderConfig(params: {
|
||||
providerId: string;
|
||||
api: string;
|
||||
api: "anthropic-messages" | "openai-completions" | "openai-responses";
|
||||
modelId?: string;
|
||||
modelName?: string;
|
||||
baseUrl?: string;
|
||||
apiKey?: string;
|
||||
}) {
|
||||
}): OpenClawConfig {
|
||||
return {
|
||||
models: {
|
||||
providers: {
|
||||
@@ -63,7 +64,7 @@ function createLegacyProviderConfig(params: {
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
} as OpenClawConfig;
|
||||
}
|
||||
|
||||
const EXPECTED_FALLBACKS = ["anthropic/claude-opus-4-5"] as const;
|
||||
|
||||
Reference in New Issue
Block a user