MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / waitFor

Function waitFor

packages/server/test/ws-resync.e2e.test.ts:160–167  ·  view source on GitHub ↗
(cond: () => boolean, timeoutMs = 2000)

Source from the content-addressed store, hash-verified

158}
159
160async function waitFor(cond: () => boolean, timeoutMs = 2000): Promise<void> {
161 const deadline = Date.now() + timeoutMs;
162 while (Date.now() < deadline) {
163 if (cond()) return;
164 await new Promise((r) => setTimeout(r, 10));
165 }
166 throw new Error(`waitFor: condition not satisfied within ${timeoutMs}ms`);
167}
168
169describe('WS durable journal + resync_required (v2)', () => {
170 it('reconnect with a cursor replays buffered events in order', async () => {

Callers 1

Calls 1

nowMethod · 0.65

Tested by

no test coverage detected