@@ -4,6 +4,7 @@ import path from "node:path";
|
4 | 4 | import { DatabaseSync } from "node:sqlite"; |
5 | 5 | import type { OpenClawConfig } from "openclaw/plugin-sdk/memory-core-host-engine-foundation"; |
6 | 6 | import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
| 7 | +import { closeAllMemorySearchManagers, getMemorySearchManager } from "./index.js"; |
7 | 8 | import type { MemoryIndexManager } from "./manager.js"; |
8 | 9 | import "./test-runtime-mocks.js"; |
9 | 10 | |
@@ -16,20 +17,14 @@ vi.mock("./embeddings.js", () => ({
|
16 | 17 | resolveEmbeddingProviderFallbackModel: () => "fts-only", |
17 | 18 | })); |
18 | 19 | |
19 | | -type MemoryIndexModule = typeof import("./index.js"); |
20 | | - |
21 | 20 | describe("memory manager FTS-only reindex", () => { |
22 | 21 | let fixtureRoot = ""; |
23 | 22 | let caseId = 0; |
24 | 23 | let workspaceDir = ""; |
25 | 24 | let indexPath = ""; |
26 | 25 | let manager: MemoryIndexManager | null = null; |
27 | | -let getMemorySearchManager: MemoryIndexModule["getMemorySearchManager"]; |
28 | | -let closeAllMemorySearchManagers: MemoryIndexModule["closeAllMemorySearchManagers"]; |
29 | 26 | |
30 | 27 | beforeAll(async () => { |
31 | | -vi.resetModules(); |
32 | | -({ getMemorySearchManager, closeAllMemorySearchManagers } = await import("./index.js")); |
33 | 28 | fixtureRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-mem-fts-only-")); |
34 | 29 | }); |
35 | 30 | |
@@ -49,12 +44,10 @@ describe("memory manager FTS-only reindex", () => {
|
49 | 44 | }); |
50 | 45 | |
51 | 46 | afterAll(async () => { |
52 | | -if (!fixtureRoot) { |
53 | | - vi.resetModules(); |
54 | | -return; |
| 47 | +await closeAllMemorySearchManagers(); |
| 48 | +if (fixtureRoot) { |
| 49 | +await fs.rm(fixtureRoot, { recursive: true, force: true }); |
55 | 50 | } |
56 | | -await fs.rm(fixtureRoot, { recursive: true, force: true }); |
57 | | -vi.resetModules(); |
58 | 51 | }); |
59 | 52 | |
60 | 53 | async function createManager(): Promise<MemoryIndexManager> { |
|