mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:54:31 +00:00
chore: Fix types in tests 26/N.
This commit is contained in:
@@ -43,10 +43,11 @@ describe("flushPendingToolResultsAfterIdle", () => {
|
||||
|
||||
it("waits for idle so real tool results can land before flush", async () => {
|
||||
const sm = guardSessionManager(SessionManager.inMemory());
|
||||
const appendMessage = sm.appendMessage.bind(sm) as unknown as (message: AgentMessage) => void;
|
||||
const idle = deferred<void>();
|
||||
const agent = { waitForIdle: () => idle.promise };
|
||||
|
||||
sm.appendMessage(assistantToolCall("call_retry_1"));
|
||||
appendMessage(assistantToolCall("call_retry_1"));
|
||||
const flushPromise = flushPendingToolResultsAfterIdle({
|
||||
agent,
|
||||
sessionManager: sm,
|
||||
@@ -58,7 +59,7 @@ describe("flushPendingToolResultsAfterIdle", () => {
|
||||
expect(getMessages(sm).map((m) => m.role)).toEqual(["assistant"]);
|
||||
|
||||
// Tool completes before idle wait finishes.
|
||||
sm.appendMessage(toolResult("call_retry_1", "command output here"));
|
||||
appendMessage(toolResult("call_retry_1", "command output here"));
|
||||
idle.resolve();
|
||||
await flushPromise;
|
||||
|
||||
@@ -72,10 +73,11 @@ describe("flushPendingToolResultsAfterIdle", () => {
|
||||
|
||||
it("flushes pending tool call after timeout when idle never resolves", async () => {
|
||||
const sm = guardSessionManager(SessionManager.inMemory());
|
||||
const appendMessage = sm.appendMessage.bind(sm) as unknown as (message: AgentMessage) => void;
|
||||
vi.useFakeTimers();
|
||||
const agent = { waitForIdle: () => new Promise<void>(() => {}) };
|
||||
|
||||
sm.appendMessage(assistantToolCall("call_orphan_1"));
|
||||
appendMessage(assistantToolCall("call_orphan_1"));
|
||||
|
||||
const flushPromise = flushPendingToolResultsAfterIdle({
|
||||
agent,
|
||||
|
||||
Reference in New Issue
Block a user