test: stabilize infra tests

This commit is contained in:
Sebastian
2026-02-16 22:37:34 -05:00
parent 759c7fc18e
commit f7d2e15a2e
5 changed files with 37 additions and 18 deletions

View File

@@ -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 = {