mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:10:43 +00:00
test: share status memory fixture
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user