MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / waitFor

Function waitFor

tests/resilient-lark-channel.test.ts:176–188  ·  view source on GitHub ↗
(
  predicate: () => boolean,
  timeoutMs = 250,
)

Source from the content-addressed store, hash-verified

174}
175
176async function waitFor(
177 predicate: () => boolean,
178 timeoutMs = 250,
179): Promise<void> {
180 const startedAt = Date.now();
181 while (Date.now() - startedAt < timeoutMs) {
182 if (predicate()) {
183 return;
184 }
185 await sleep(5);
186 }
187 assert.equal(predicate(), true);
188}
189
190test("resilient channel keeps handlers after rebuild", async () => {
191 const { channel, channels } = createHarness();

Callers 1

Calls 1

sleepFunction · 0.85

Tested by

no test coverage detected