MCPcopy
hub / github.com/coder/mux / waitForCondition

Function waitForCondition

src/node/services/agentSession.editMessageId.test.ts:22–31  ·  view source on GitHub ↗
(condition: () => boolean, timeoutMs = 1000)

Source from the content-addressed store, hash-verified

20} as unknown as Config;
21
22async function waitForCondition(condition: () => boolean, timeoutMs = 1000): Promise<boolean> {
23 if (condition()) {
24 return true;
25 }
26 if (timeoutMs <= 0) {
27 return false;
28 }
29 await new Promise((resolve) => setTimeout(resolve, 10));
30 return waitForCondition(condition, timeoutMs - 10);
31}
32
33describe("AgentSession.sendMessage (editMessageId)", () => {
34 let historyCleanup: (() => Promise<void>) | undefined;

Calls

no outgoing calls

Tested by

no test coverage detected