MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitFor

Function waitFor

packages/react/src/api/oauth-popup.test.ts:246–252  ·  view source on GitHub ↗
(predicate: () => boolean)

Source from the content-addressed store, hash-verified

244 });
245
246 const waitFor = async (predicate: () => boolean): Promise<void> => {
247 const deadline = Date.now() + 2000;
248 while (!predicate() && Date.now() < deadline) {
249 await new Promise<void>((resolve) => setTimeout(resolve, 5));
250 }
251 expect(predicate()).toBe(true);
252 };
253
254 const withFakeFetch = async (fake: typeof fetch, run: () => Promise<void>): Promise<void> => {
255 const previousFetch = globalThis.fetch;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected