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