chore: We have a sleep at home. The sleep at home:

This commit is contained in:
cpojer
2026-02-02 21:34:47 +09:00
parent dfef943f0a
commit 6b0d6e2540
18 changed files with 69 additions and 49 deletions

View File

@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { sleep } from "../utils.ts";
const callGatewayMock = vi.fn();
vi.mock("../gateway/call.js", () => ({
@@ -82,7 +83,12 @@ describe("openclaw-tools: subagents", () => {
if (request.method === "agent.wait") {
const params = request.params as { runId?: string; timeoutMs?: number } | undefined;
waitCalls.push(params ?? {});
return { runId: params?.runId ?? "run-1", status: "ok", startedAt: 1000, endedAt: 2000 };
return {
runId: params?.runId ?? "run-1",
status: "ok",
startedAt: 1000,
endedAt: 2000,
};
}
if (request.method === "sessions.patch") {
const params = request.params as { key?: string; label?: string } | undefined;
@@ -126,9 +132,9 @@ describe("openclaw-tools: subagents", () => {
},
});
await new Promise((resolve) => setTimeout(resolve, 0));
await new Promise((resolve) => setTimeout(resolve, 0));
await new Promise((resolve) => setTimeout(resolve, 0));
await sleep(0);
await sleep(0);
await sleep(0);
const childWait = waitCalls.find((call) => call.runId === childRunId);
expect(childWait?.timeoutMs).toBe(1000);