diff --git a/src/infra/jsonl-socket.test.ts b/src/infra/jsonl-socket.test.ts index 3524a3f9d4d..17922dc167f 100644 --- a/src/infra/jsonl-socket.test.ts +++ b/src/infra/jsonl-socket.test.ts @@ -20,6 +20,11 @@ async function listenOnSocket(server: net.Server, socketPath: string): Promise { it("ignores malformed and non-accepted lines until one is accepted", async () => { await withTempDir({ prefix: "openclaw-jsonl-socket-" }, async (dir) => { @@ -42,10 +47,7 @@ describe.runIf(process.platform !== "win32")("requestJsonlSocket", () => { socketPath, requestLine: '{"hello":"world"}', timeoutMs: 500, - accept: (msg) => { - const value = msg as { type?: string; value?: number }; - return value.type === "done" ? (value.value ?? null) : undefined; - }, + accept: acceptDoneValue, }), ).resolves.toBe(42); } finally { @@ -79,10 +81,7 @@ describe.runIf(process.platform !== "win32")("requestJsonlSocket", () => { socketPath, requestLine: '{"hello":"world"}', timeoutMs: 500, - accept: (msg) => { - const value = msg as { type?: string; value?: number }; - return value.type === "done" ? (value.value ?? null) : undefined; - }, + accept: acceptDoneValue, }), ).resolves.toBe(7); expect(receivedBuffer).toBe('{"hello":"world"}\n');