test: stabilize agent embedded-run mocks

This commit is contained in:
Peter Steinberger
2026-02-22 11:25:59 +00:00
parent 7d09a9e74d
commit 9f2444314d
2 changed files with 24 additions and 1 deletions

View File

@@ -2,7 +2,6 @@ import fs from "node:fs";
import path from "node:path";
import { beforeEach, describe, expect, it, type MockInstance, vi } from "vitest";
import { telegramPlugin } from "../../extensions/telegram/src/channel.js";
import "../cron/isolated-agent.mocks.js";
import { setTelegramRuntime } from "../../extensions/telegram/src/runtime.js";
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
import { loadModelCatalog } from "../agents/model-catalog.js";
@@ -16,6 +15,22 @@ import type { RuntimeEnv } from "../runtime.js";
import { createTestRegistry } from "../test-utils/channel-plugins.js";
import { agentCommand } from "./agent.js";
vi.mock("../agents/pi-embedded.js", () => ({
runEmbeddedPiAgent: vi.fn(),
}));
vi.mock("../agents/model-catalog.js", () => ({
loadModelCatalog: vi.fn(),
}));
vi.mock("../agents/model-selection.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../agents/model-selection.js")>();
return {
...actual,
isCliProvider: vi.fn(() => false),
};
});
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),

View File

@@ -10,6 +10,14 @@ vi.mock("../agents/model-catalog.js", () => ({
loadModelCatalog: vi.fn(),
}));
vi.mock("../agents/model-selection.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../agents/model-selection.js")>();
return {
...actual,
isCliProvider: vi.fn(() => false),
};
});
vi.mock("../agents/subagent-announce.js", () => ({
runSubagentAnnounceFlow: vi.fn(),
}));