mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:21:23 +00:00
chore: Fix types in tests 44/N.
This commit is contained in:
@@ -33,7 +33,10 @@ describe("handleDiscordPresenceAction", () => {
|
||||
status: "online",
|
||||
afk: false,
|
||||
});
|
||||
const payload = JSON.parse(result.content[0].text ?? "");
|
||||
const textBlock = result.content.find((block) => block.type === "text");
|
||||
const payload = JSON.parse(
|
||||
(textBlock as { type: "text"; text: string } | undefined)?.text ?? "{}",
|
||||
);
|
||||
expect(payload.ok).toBe(true);
|
||||
expect(payload.activities[0]).toEqual({ type: 0, name: "with fire" });
|
||||
});
|
||||
|
||||
@@ -183,6 +183,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
models: {
|
||||
providers: {
|
||||
acme: {
|
||||
baseUrl: "https://example.com",
|
||||
models: [
|
||||
makeModelDefinition("text-1", ["text"]),
|
||||
makeModelDefinition("vision-1", ["text", "image"]),
|
||||
@@ -228,6 +229,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
models: {
|
||||
providers: {
|
||||
acme: {
|
||||
baseUrl: "https://example.com",
|
||||
models: [makeModelDefinition("vision-1", ["text", "image"])],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ function mockSendResult(overrides: { channel?: string; to?: string } = {}) {
|
||||
kind: "send",
|
||||
action: "send",
|
||||
channel: overrides.channel ?? "telegram",
|
||||
...(overrides.to ? { to: overrides.to } : {}),
|
||||
to: overrides.to ?? "telegram:123",
|
||||
handledBy: "plugin",
|
||||
payload: {},
|
||||
dryRun: true,
|
||||
|
||||
@@ -76,7 +76,7 @@ describe("handleTelegramAction", () => {
|
||||
reactMessageTelegram.mockResolvedValueOnce({
|
||||
ok: false,
|
||||
warning: "Reaction unavailable: ✅",
|
||||
});
|
||||
} as unknown as Awaited<ReturnType<typeof reactMessageTelegram>>);
|
||||
const result = await handleTelegramAction(defaultReactionAction, reactionConfig("minimal"));
|
||||
const textPayload = result.content.find((item) => item.type === "text");
|
||||
expect(textPayload?.type).toBe("text");
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("web_fetch response size limits", () => {
|
||||
|
||||
const tool = createWebFetchTool(baseToolConfig);
|
||||
const result = await tool?.execute?.("call", { url: "https://example.com/stream" });
|
||||
|
||||
expect(result?.details?.warning).toContain("Response body truncated");
|
||||
const details = result?.details as { warning?: string } | undefined;
|
||||
expect(details?.warning).toContain("Response body truncated");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user