mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 17:40:44 +00:00
test: speed up subagent registry persistence tests
This commit is contained in:
@@ -63,6 +63,7 @@ export function createSubagentRegistryTestDeps(
|
||||
): Record<string, unknown> {
|
||||
return {
|
||||
cleanupBrowserSessionsForLifecycleEnd: vi.fn(async () => {}),
|
||||
captureSubagentCompletionReply: vi.fn(async () => undefined),
|
||||
ensureContextEnginesInitialized: vi.fn(),
|
||||
ensureRuntimePluginsLoaded: vi.fn(),
|
||||
getRuntimeConfig: vi.fn(() => ({})),
|
||||
|
||||
@@ -188,6 +188,8 @@ describe("subagent registry persistence", () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
announceSpy.mockReset();
|
||||
announceSpy.mockResolvedValue(true);
|
||||
__testing.setDepsForTest({
|
||||
...createSubagentRegistryTestDeps(),
|
||||
persistSubagentRunsToDisk: fastPersistSubagentRunsToDisk,
|
||||
@@ -204,7 +206,6 @@ describe("subagent registry persistence", () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
announceSpy.mockClear();
|
||||
__testing.setDepsForTest();
|
||||
resetSubagentRegistryForTests({ persist: false });
|
||||
await drainSessionStoreWriterQueuesForTest();
|
||||
@@ -670,6 +671,15 @@ describe("subagent registry persistence", () => {
|
||||
});
|
||||
|
||||
it("keeps stale unended restored runs with abortedLastRun for restart recovery", async () => {
|
||||
vi.mocked(callGateway).mockImplementationOnce(async (request) => {
|
||||
expect(request).toMatchObject({
|
||||
method: "agent.wait",
|
||||
params: { runId: "run-stale-aborted-restore" },
|
||||
});
|
||||
return {
|
||||
status: "pending",
|
||||
};
|
||||
});
|
||||
const now = Date.now();
|
||||
const runId = "run-stale-aborted-restore";
|
||||
const childSessionKey = "agent:main:subagent:stale-aborted-restore";
|
||||
|
||||
Reference in New Issue
Block a user