mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-27 00:17:29 +00:00
test: trim more runtime partial mocks
This commit is contained in:
@@ -14,8 +14,10 @@ import { CRITICAL_THRESHOLD, GLOBAL_CIRCUIT_BREAKER_THRESHOLD } from "./tool-loo
|
|||||||
import type { AnyAgentTool } from "./tools/common.js";
|
import type { AnyAgentTool } from "./tools/common.js";
|
||||||
import { callGatewayTool } from "./tools/gateway.js";
|
import { callGatewayTool } from "./tools/gateway.js";
|
||||||
|
|
||||||
vi.mock("../plugins/hook-runner-global.js", async (importOriginal) => {
|
vi.mock("../plugins/hook-runner-global.js", async () => {
|
||||||
const actual = await importOriginal<typeof import("../plugins/hook-runner-global.js")>();
|
const actual = await vi.importActual<typeof import("../plugins/hook-runner-global.js")>(
|
||||||
|
"../plugins/hook-runner-global.js",
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
getGlobalHookRunner: vi.fn(),
|
getGlobalHookRunner: vi.fn(),
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ const mocks = vi.hoisted(() => ({
|
|||||||
writtenConfig: undefined as Record<string, unknown> | undefined,
|
writtenConfig: undefined as Record<string, unknown> | undefined,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("./models/shared.js", async (importOriginal) => {
|
vi.mock("./models/shared.js", async () => {
|
||||||
const actual = await importOriginal<typeof import("./models/shared.js")>();
|
const actual = await vi.importActual<typeof import("./models/shared.js")>("./models/shared.js");
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
updateConfig: async (mutator: (cfg: Record<string, unknown>) => Record<string, unknown>) => {
|
updateConfig: async (mutator: (cfg: Record<string, unknown>) => Record<string, unknown>) => {
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ export async function loadStatusScanModuleForTest(
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
vi.doMock("../config/paths.js", async (importOriginal) => {
|
vi.doMock("../config/paths.js", async () => {
|
||||||
const actual = await importOriginal<typeof import("../config/paths.js")>();
|
const actual = await vi.importActual<typeof import("../config/paths.js")>("../config/paths.js");
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
resolveConfigPath: mocks.resolveConfigPath,
|
resolveConfigPath: mocks.resolveConfigPath,
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
|||||||
const getLatestSubagentRunByChildSessionKeyMock = vi.fn();
|
const getLatestSubagentRunByChildSessionKeyMock = vi.fn();
|
||||||
const replaceSubagentRunAfterSteerMock = vi.fn();
|
const replaceSubagentRunAfterSteerMock = vi.fn();
|
||||||
|
|
||||||
vi.mock("../agents/subagent-registry-read.js", async (importOriginal) => {
|
vi.mock("../agents/subagent-registry-read.js", async () => {
|
||||||
const actual = await importOriginal<typeof import("../agents/subagent-registry-read.js")>();
|
const actual = await vi.importActual<typeof import("../agents/subagent-registry-read.js")>(
|
||||||
|
"../agents/subagent-registry-read.js",
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
getLatestSubagentRunByChildSessionKey: (...args: unknown[]) =>
|
getLatestSubagentRunByChildSessionKey: (...args: unknown[]) =>
|
||||||
|
|||||||
@@ -175,8 +175,9 @@ describe("applyMediaUnderstanding – echo transcript", () => {
|
|||||||
vi.doMock("../infra/outbound/deliver-runtime.js", () => ({
|
vi.doMock("../infra/outbound/deliver-runtime.js", () => ({
|
||||||
deliverOutboundPayloads: (...args: unknown[]) => mockDeliverOutboundPayloads(...args),
|
deliverOutboundPayloads: (...args: unknown[]) => mockDeliverOutboundPayloads(...args),
|
||||||
}));
|
}));
|
||||||
vi.doMock("./provider-registry.js", async (importOriginal) => {
|
vi.doMock("./provider-registry.js", async () => {
|
||||||
const actual = await importOriginal<typeof import("./provider-registry.js")>();
|
const actual =
|
||||||
|
await vi.importActual<typeof import("./provider-registry.js")>("./provider-registry.js");
|
||||||
const registryProviders = createRegistryMediaProviders();
|
const registryProviders = createRegistryMediaProviders();
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
|
|||||||
Reference in New Issue
Block a user