test: share status memory fixture

This commit is contained in:
Peter Steinberger
2026-04-19 02:17:13 +01:00
parent 10d7c4d50e
commit 6798cbbd52

View File

@@ -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,