mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
fix: route memory test harness through plugin sdk
This commit is contained in:
@@ -2,14 +2,14 @@ import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterAll, beforeAll, beforeEach, expect, vi, type Mock } from "vitest";
|
||||
import type {
|
||||
MemoryIndexManager,
|
||||
MemorySearchManager,
|
||||
} from "../../extensions/memory-core/src/memory/index.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import type { MemoryIndexManager } from "../plugin-sdk/memory-core.js";
|
||||
|
||||
type EmbeddingTestMocksModule = typeof import("./embedding.test-mocks.js");
|
||||
type MemoryIndexModule = typeof import("../../extensions/memory-core/src/memory/index.js");
|
||||
type MemoryIndexModule = typeof import("../plugin-sdk/memory-core.js");
|
||||
type MemorySearchManagerHandle = Awaited<
|
||||
ReturnType<MemoryIndexModule["getMemorySearchManager"]>
|
||||
>["manager"];
|
||||
|
||||
export function installEmbeddingManagerFixture(opts: {
|
||||
fixturePrefix: string;
|
||||
@@ -46,7 +46,7 @@ export function installEmbeddingManagerFixture(opts: {
|
||||
};
|
||||
|
||||
const requireIndexManager = (
|
||||
manager: MemorySearchManager | null,
|
||||
manager: MemorySearchManagerHandle,
|
||||
name: string,
|
||||
): MemoryIndexManager => {
|
||||
if (!manager) {
|
||||
@@ -64,7 +64,7 @@ export function installEmbeddingManagerFixture(opts: {
|
||||
const embeddingMocks = await import("./embedding.test-mocks.js");
|
||||
embedBatch = embeddingMocks.getEmbedBatchMock();
|
||||
resetEmbeddingMocks = embeddingMocks.resetEmbeddingMocks;
|
||||
({ getMemorySearchManager } = await import("../../extensions/memory-core/src/memory/index.js"));
|
||||
({ getMemorySearchManager } = await import("../plugin-sdk/memory-core.js"));
|
||||
fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), opts.fixturePrefix));
|
||||
workspaceDir = path.join(fixtureRoot, "workspace");
|
||||
memoryDir = path.join(workspaceDir, "memory");
|
||||
|
||||
Reference in New Issue
Block a user