mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-20 16:15:15 +00:00
test: stabilize agent embedded-run mocks
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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(),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user