mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
test(agents): mock incremental registry persistence (#116307)
This commit is contained in:
@@ -21,6 +21,7 @@ const mocks = vi.hoisted(() => ({
|
||||
runSubagentAnnounceFlow: vi.fn().mockResolvedValue(false),
|
||||
captureSubagentCompletionReply: vi.fn(),
|
||||
loadSubagentRegistryFromSqlite: vi.fn(() => new Map()),
|
||||
saveSubagentRegistryChangesToSqlite: vi.fn(),
|
||||
saveSubagentRegistryToSqlite: vi.fn(),
|
||||
resolveAgentTimeoutMs: vi.fn(() => 60_000),
|
||||
scheduleOrphanRecovery: vi.fn(),
|
||||
@@ -68,6 +69,7 @@ vi.mock("../infra/agent-events.js", () => ({
|
||||
|
||||
vi.mock("./subagent-registry.store.sqlite.js", () => ({
|
||||
loadSubagentRegistryFromSqlite: mocks.loadSubagentRegistryFromSqlite,
|
||||
saveSubagentRegistryChangesToSqlite: mocks.saveSubagentRegistryChangesToSqlite,
|
||||
saveSubagentRegistryToSqlite: mocks.saveSubagentRegistryToSqlite,
|
||||
}));
|
||||
|
||||
@@ -131,6 +133,7 @@ describe("announce loop guard (#18264)", () => {
|
||||
mocks.runSubagentAnnounceFlow.mockReset();
|
||||
mocks.runSubagentAnnounceFlow.mockResolvedValue(false);
|
||||
mocks.scheduleOrphanRecovery.mockClear();
|
||||
mocks.saveSubagentRegistryChangesToSqlite.mockClear();
|
||||
mocks.saveSubagentRegistryToSqlite.mockClear();
|
||||
mocks.updateSessionStore.mockClear();
|
||||
registry.resetSubagentRegistryForTests({ persist: false });
|
||||
@@ -221,6 +224,9 @@ describe("announce loop guard (#18264)", () => {
|
||||
|
||||
expect(mocks.runSubagentAnnounceFlow).not.toHaveBeenCalled();
|
||||
expect(entry.cleanupCompletedAt).toBeGreaterThanOrEqual(beforeInit);
|
||||
expect(mocks.saveSubagentRegistryChangesToSqlite).toHaveBeenCalledWith(expect.any(Map), [
|
||||
entry.runId,
|
||||
]);
|
||||
});
|
||||
|
||||
test("expired completion-message entries are still resumed for announce", async () => {
|
||||
|
||||
Reference in New Issue
Block a user