From 6798cbbd529b3a3144fb76ba2bacc20d3fa31ae5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 19 Apr 2026 02:17:13 +0100 Subject: [PATCH] test: share status memory fixture --- src/commands/status.scan-memory.test.ts | 54 ++++++++++--------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/src/commands/status.scan-memory.test.ts b/src/commands/status.scan-memory.test.ts index 268743c0b7f..ddd483f51c4 100644 --- a/src/commands/status.scan-memory.test.ts +++ b/src/commands/status.scan-memory.test.ts @@ -18,6 +18,25 @@ vi.mock("./status.scan.shared.js", () => ({ resolveSharedMemoryStatusSnapshot: mocks.resolveSharedMemoryStatusSnapshot, })); +function createMainAgentStatus() { + return { + defaultId: "main", + totalSessions: 0, + bootstrapPendingCount: 0, + agents: [ + { + id: "main", + workspaceDir: null, + bootstrapPending: false, + sessionsPath: "/tmp/main.json", + sessionsCount: 0, + lastUpdatedAt: null, + lastActiveAgeMs: null, + }, + ], + }; +} + describe("status.scan-memory", () => { beforeEach(() => { vi.clearAllMocks(); @@ -28,46 +47,17 @@ describe("status.scan-memory", () => { const { resolveStatusMemoryStatusSnapshot } = await import("./status.scan-memory.ts"); const requireDefaultStore = vi.fn((agentId: string) => `/tmp/${agentId}.sqlite`); + const agentStatus = createMainAgentStatus(); await resolveStatusMemoryStatusSnapshot({ cfg: { agents: {} }, - agentStatus: { - defaultId: "main", - totalSessions: 0, - bootstrapPendingCount: 0, - agents: [ - { - id: "main", - workspaceDir: null, - bootstrapPending: false, - sessionsPath: "/tmp/main.json", - sessionsCount: 0, - lastUpdatedAt: null, - lastActiveAgeMs: null, - }, - ], - }, + agentStatus, memoryPlugin: { enabled: true, slot: "memory-core" }, requireDefaultStore, }); expect(mocks.resolveSharedMemoryStatusSnapshot).toHaveBeenCalledWith({ cfg: { agents: {} }, - agentStatus: { - defaultId: "main", - totalSessions: 0, - bootstrapPendingCount: 0, - agents: [ - { - id: "main", - workspaceDir: null, - bootstrapPending: false, - sessionsPath: "/tmp/main.json", - sessionsCount: 0, - lastUpdatedAt: null, - lastActiveAgeMs: null, - }, - ], - }, + agentStatus, memoryPlugin: { enabled: true, slot: "memory-core" }, resolveMemoryConfig: mocks.resolveMemorySearchConfig, getMemorySearchManager: mocks.getMemorySearchManager,