mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:48:27 +00:00
test: share memory manager bootstrap helper
This commit is contained in:
@@ -3,8 +3,9 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { getMemorySearchManager, type MemoryIndexManager } from "./index.js";
|
||||
import type { MemoryIndexManager } from "./index.js";
|
||||
import { createOpenAIEmbeddingProviderMock } from "./test-embeddings-mock.js";
|
||||
import { createMemoryManagerOrThrow } from "./test-manager.js";
|
||||
|
||||
const embedBatch = vi.fn(async () => []);
|
||||
const embedQuery = vi.fn(async () => [0.2, 0.2, 0.2]);
|
||||
@@ -56,12 +57,7 @@ describe("memory search async sync", () => {
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
const result = await getMemorySearchManager({ cfg, agentId: "main" });
|
||||
expect(result.manager).not.toBeNull();
|
||||
if (!result.manager) {
|
||||
throw new Error("manager missing");
|
||||
}
|
||||
manager = result.manager as unknown as MemoryIndexManager;
|
||||
manager = await createMemoryManagerOrThrow(cfg);
|
||||
|
||||
const pending = new Promise<void>(() => {});
|
||||
const syncMock = vi.fn(async () => pending);
|
||||
|
||||
Reference in New Issue
Block a user