fix: close memory cli managers

This commit is contained in:
Peter Steinberger
2026-01-17 19:20:47 +00:00
parent 2d4de656d2
commit 53218b91c6
3 changed files with 111 additions and 36 deletions

View File

@@ -26,6 +26,7 @@ describe("memory cli", () => {
it("prints vector status when available", async () => {
const { registerMemoryCli } = await import("./memory-cli.js");
const { defaultRuntime } = await import("../runtime.js");
const close = vi.fn(async () => {});
getMemorySearchManager.mockResolvedValueOnce({
manager: {
status: () => ({
@@ -44,6 +45,7 @@ describe("memory cli", () => {
dims: 1024,
},
}),
close,
},
});
@@ -56,11 +58,13 @@ describe("memory cli", () => {
expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector: ready"));
expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector dims: 1024"));
expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector path: /opt/sqlite-vec.dylib"));
expect(close).toHaveBeenCalled();
});
it("prints vector error when unavailable", async () => {
const { registerMemoryCli } = await import("./memory-cli.js");
const { defaultRuntime } = await import("../runtime.js");
const close = vi.fn(async () => {});
getMemorySearchManager.mockResolvedValueOnce({
manager: {
status: () => ({
@@ -78,6 +82,7 @@ describe("memory cli", () => {
loadError: "load failed",
},
}),
close,
},
});
@@ -89,5 +94,6 @@ describe("memory cli", () => {
expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector: unavailable"));
expect(log).toHaveBeenCalledWith(expect.stringContaining("Vector error: load failed"));
expect(close).toHaveBeenCalled();
});
});