test(memory-core): keep memory tool mock local to plugin

This commit is contained in:
Vincent Koc
2026-04-10 08:04:16 +01:00
parent 3cea11d3b6
commit 975e69b00b
4 changed files with 5 additions and 21 deletions

View File

@@ -39,20 +39,7 @@ const readAgentMemoryFileMock = vi.fn(
async (params: MemoryReadParams) => await readFileImpl(params),
);
const { memoryIndexModuleId, memoryToolsRuntimeModuleId } = vi.hoisted(() => ({
memoryIndexModuleId: "../../extensions/memory-core/src/memory/index.js",
memoryToolsRuntimeModuleId: "../../extensions/memory-core/src/tools.runtime.js",
}));
vi.mock(memoryIndexModuleId, () => ({
getMemorySearchManager: getMemorySearchManagerMock,
}));
vi.mock("../../src/memory-host-sdk/host/read-file.js", () => ({
readAgentMemoryFile: readAgentMemoryFileMock,
}));
vi.mock(memoryToolsRuntimeModuleId, () => ({
vi.mock("./tools.runtime.js", () => ({
resolveMemoryBackendConfig: ({
cfg,
}: {

View File

@@ -14,7 +14,7 @@ import {
setMemorySearchImpl,
setMemoryWorkspaceDir,
type MemoryReadParams,
} from "../../../test/helpers/memory-tool-manager-mock.js";
} from "./memory-tool-manager-mock.js";
import { createMemoryCoreTestHarness } from "./test-helpers.js";
import {
asOpenClawConfig,

View File

@@ -1,11 +1,11 @@
import type { MemorySearchResult } from "openclaw/plugin-sdk/memory-core-host-runtime-files";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../api.js";
import {
resetMemoryToolMockState,
setMemoryBackend,
setMemorySearchImpl,
} from "../../../test/helpers/memory-tool-manager-mock.js";
import type { OpenClawConfig } from "../api.js";
} from "./memory-tool-manager-mock.js";
import { createMemorySearchTool } from "./tools.js";
type RecordShortTermRecallsFn = (params: {

View File

@@ -1,8 +1,5 @@
import { beforeEach, describe, it } from "vitest";
import {
resetMemoryToolMockState,
setMemorySearchImpl,
} from "../../../test/helpers/memory-tool-manager-mock.js";
import { resetMemoryToolMockState, setMemorySearchImpl } from "./memory-tool-manager-mock.js";
import {
createMemorySearchToolOrThrow,
expectUnavailableMemorySearchDetails,