mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:18:28 +00:00
test: stabilize infra tests
This commit is contained in:
@@ -2,12 +2,12 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { telegramPlugin } from "../../extensions/telegram/src/channel.js";
|
||||
import { setTelegramRuntime } from "../../extensions/telegram/src/runtime.js";
|
||||
import { whatsappPlugin } from "../../extensions/whatsapp/src/channel.js";
|
||||
import { setWhatsAppRuntime } from "../../extensions/whatsapp/src/runtime.js";
|
||||
import * as replyModule from "../auto-reply/reply.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveAgentMainSessionKey, resolveMainSessionKey } from "../config/sessions.js";
|
||||
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { createPluginRuntime } from "../plugins/runtime/index.js";
|
||||
@@ -75,7 +75,10 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("runHeartbeatOnce – heartbeat model override", () => {
|
||||
async function runDefaultsHeartbeat(params: { model?: string }) {
|
||||
async function runDefaultsHeartbeat(params: {
|
||||
model?: string;
|
||||
suppressToolErrorWarnings?: boolean;
|
||||
}) {
|
||||
return withHeartbeatFixture(async ({ tmpDir, storePath, seedSession }) => {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
@@ -85,6 +88,7 @@ describe("runHeartbeatOnce – heartbeat model override", () => {
|
||||
every: "5m",
|
||||
target: "whatsapp",
|
||||
model: params.model,
|
||||
suppressToolErrorWarnings: params.suppressToolErrorWarnings,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -121,6 +125,16 @@ describe("runHeartbeatOnce – heartbeat model override", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("passes suppressToolErrorWarnings when configured", async () => {
|
||||
const replyOpts = await runDefaultsHeartbeat({ suppressToolErrorWarnings: true });
|
||||
expect(replyOpts).toEqual(
|
||||
expect.objectContaining({
|
||||
isHeartbeat: true,
|
||||
suppressToolErrorWarnings: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("passes per-agent heartbeat model override (merged with defaults)", async () => {
|
||||
await withHeartbeatFixture(async ({ storePath, seedSession }) => {
|
||||
const cfg: OpenClawConfig = {
|
||||
|
||||
Reference in New Issue
Block a user